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

oltre 10 anni fa | 0

| accettato

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 1

| accettato

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

oltre 10 anni fa | 0

| accettato

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

oltre 10 anni fa | 0

| accettato

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 0

| accettato

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

oltre 10 anni fa | 0

| accettato

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

oltre 10 anni fa | 1

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 1

| accettato

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

oltre 10 anni fa | 1

| accettato

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

oltre 10 anni fa | 1

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

oltre 10 anni fa | 1

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 1

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 0

| accettato

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 1

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 1

| accettato

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 1

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

oltre 10 anni fa | 1

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

oltre 10 anni fa | 0

| accettato

Carica altro