Answered
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']);...

10 years ago | 0

| accepted

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

10 years ago | 0

Answered
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...

10 years ago | 1

| accepted

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

10 years ago | 0

| accepted

Answered
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(...

10 years ago | 0

| accepted

Answered
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(:...

10 years ago | 0

Answered
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 ...

10 years ago | 0

| accepted

Answered
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...

10 years ago | 0

| accepted

Answered
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: ...

10 years ago | 1

Answered
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...

10 years ago | 0

Answered
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...

10 years ago | 0

Answered
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...

10 years ago | 1

| accepted

Answered
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...

10 years ago | 1

| accepted

Answered
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','...

10 years ago | 1

Answered
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...

10 years ago | 1

Answered
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...

10 years ago | 0

Answered
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...

10 years ago | 0

Answered
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...

10 years ago | 0

Answered
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...

10 years ago | 1

Answered
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...

10 years ago | 0

Answered
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...

10 years ago | 0

| accepted

Answered
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)

10 years ago | 0

Answered
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?

10 years ago | 0

Answered
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)]

10 years ago | 1

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

10 years ago | 0

Answered
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]

10 years ago | 1

| accepted

Answered
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...

10 years ago | 0

Answered
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,:)

10 years ago | 1

Answered
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...

10 years ago | 1

Answered
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...

10 years ago | 0

| accepted

Load more