Respondida
How to get rid of the error: Error using horzcat. Dimensions of matrices being concatenated are not consistent.
This is not going well: thisLine=imresize(thisLine,[100 100]); imwrite(thisLine,['Datasets/',num2str(thisLine),'.jpg']);...

más de 10 años hace | 0

| aceptada

Respondida
Write a computer program that determines how many grades are between 0 and 19
help numel help for help if or help histc

más de 10 años hace | 0

Respondida
Why do I get this error "In an assignment A(:) = B, the number of elements in A and B must be the same"?
You seem to use the variable n in two ways: # an unsorted variable (vector? or array?) # the number of elements of something...

más de 10 años hace | 1

| aceptada

Respondida
Difficulty with nested loop and arrays
for RowIndex = 1:... for ColIndex = 1:... CurrentValue = MyMatrix(RowIndex,ColIndex) end end...

más de 10 años hace | 0

| aceptada

Respondida
Vectorize for-loop that changes overlapping parts of an array
Easy when using convolution: logarray = logical([0 1 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 1]) N = 2 ; out = conv2(...

más de 10 años hace | 0

| aceptada

Respondida
find combination of labels
A simple one-liner will do A = [618 574 608] B = [574 2;574 3;608 1;618 1;618 2;618 3;618 4] C1 = arrayfun(@(k) B(B(:...

más de 10 años hace | 0

Respondida
How to I use previously calculated value in next iteration until the value converges?
Your for loop just runs once, using the single value of a. You might do better using a while loop % init values go here ...

más de 10 años hace | 0

| aceptada

Respondida
How to create double spacing between all command prompts
No, you cannot change those properties in matlab. But why not copy the command window to a text processor and change everythi...

más de 10 años hace | 0

| aceptada

Respondida
Sum of numbers from a notepad file
If the text file only contains numbers,and there are the same amount on each row, try using load to read the file in matlab: ...

más de 10 años hace | 1

Respondida
FInd the distribution of some random numbers
There are so many distributions that you have to make some choices. First, look at the distribution of your numbers and, by shee...

más de 10 años hace | 0

Respondida
Logical indexing two dimensions. How do I avoid a nested for loop?
Pre-allocate *but also* put the transpose out of the loop! T = T.' ; A = zeros(400,400,9,64) for n = 1 : 64 fo...

más de 10 años hace | 0

Respondida
remove rows under certain condition
Assuming your X, Y, and Z variables are stored in three vectors of equal length [UniqueXY, ~, k] = unique([X(:) Y(:)],'rows...

más de 10 años hace | 1

| aceptada

Respondida
Formula for Poisson distribution
I am not sure why you have three parameters rather than 1. See <https://en.wikipedia.org/wiki/Poisson_distribution> In your c...

más de 10 años hace | 1

| aceptada

Respondida
how many times a string is present in a cell array
One of the simplest ways: a = {'2';'23';'231';'2312';'23121';'231213';'3';'31'}; b ={'2','21','','','','','';'3','32','...

más de 10 años hace | 1

Respondida
How to manipulate arrays inside a cell array?
Write a function that does this for a single element of the cell array and then use cell fun If you can write the function as a...

más de 10 años hace | 1

Respondida
find a cell array of strings in another cell array of strings
So you want the keep the elements in B that are not in A. This is known is the difference in sets, implemented in matlab like th...

más de 10 años hace | 0

Respondida
How to remove duplicates from a matrix without using unique?
I do not see any reason why you can't use *unique* A = randi(5,5,10) % some data C = arrayfun(@(k) unique(A(:,k),'stable...

más de 10 años hace | 0

Respondida
How to remove duplicate observations in a matrix after sorting it?
FINAL=[1001,4,5,2015;1002,4,5,2015;1001,4,10,2014;1003,4,10,2014] X = sortrows(FINAL,[1 4 2 3]) % not sure what you want he...

más de 10 años hace | 0

Respondida
how many times a string is present in a cell array
A job for COUNTMEMBER! Download it here from the file exchange: <http://www.mathworks.com/matlabcentral/fileexchange/7738-co...

más de 10 años hace | 1

Respondida
How do I sum all the y values of a scatter plot to turn it into a histogram?
The second output of *histc* provides the bins in which each data point is located. You can use this to sum the elements grouped...

más de 10 años hace | 0

Respondida
Steps between to elements of a matrix
This might help you further: A = [1 1 2 2 0 1 1 1 1 0; 1 0 2 2 0 1 1 1 1 0; 1 1 2 2 1 1 1 1 1 1; 1 1 2 2 1 1 0 1 0 1; 1 1...

más de 10 años hace | 0

| aceptada

Respondida
Is it possible to convert/transform a normally distributed random variable to a Poisson-variable?
You could try an <https://en.wikipedia.org/wiki/Anscombe_transform Anscombe transformation>: y = 2 * sqrt(x + 3/8)

más de 10 años hace | 0

Respondida
I cant create array x=[1 2], because of Attempt to execute SCRIPT horzcat as a function
What does the command which horzcat tell you? And does solve clear horzcat solve the problem?

más de 10 años hace | 0

Respondida
swiching elements of same vector
Easy: X = [20 0 0 0 100 0 0 50 0]' [i,~,v] = find(X) X(i) = [0 ; v(1:end-1)]

más de 10 años hace | 1

Respondida
About Cell arrays access
a{1}={'teste' 4}, a{2}={'meste' 5}, a{3}={'zeste' 6}, B = cellfun(@(x) x{1}(1),a)

más de 10 años hace | 0

Respondida
is there anyone assist me for write a for loop that will calculate the power n of a given number x on MATLAB?
n = 4 x = 2 y = 1 for k=1:n y = y * x end [x.^n y]

más de 10 años hace | 1

| aceptada

Respondida
How to apply efficient if-else statements in a big data cell array
It is a cell array, but each cell has a single number? Then you might be better of converting it to numbers first: N = cell...

más de 10 años hace | 0

Respondida
delete first x number of rows from a cell array
Each cell in the 4th row of A should contain a scalar, being 0 or another value tf = [A{:,4}] ~= 0 Aout = A(tf,:)

más de 10 años hace | 1

Respondida
i want to find row indices for each column having non zero values
A = [1 1 0 1; 1 1 0 0; 0 0 1 1] C = arrayfun(@(k) find(A(:,k)),1:size(A,2),'un',0) % C{x} holds the row numbers for whi...

más de 10 años hace | 1

Respondida
Search all strings occuring in structure
So, I assume: * in your array A, A(1:8) belong to the same number, A(9:16) to another mother, etc.. * There are N mothers an...

más de 10 años hace | 0

| aceptada

Cargar más