MATLAB setting matrix values in an array

Posted by user324994 on Stack Overflow See other posts from Stack Overflow or by user324994
Published on 2010-05-03T05:33:13Z Indexed on 2010/05/03 5:38 UTC
Read the original article Hit count: 240

Filed under:
|

I'm trying to write some code to calculate a cumulative distribution function in matlab. When I try to actually put my results into an array it yells at me.

tempnum = ordered1(1);
k=2;
while(k<538)
    count = 1;
    while(ordered1(k)==tempnum)
        count = count + 1;
        k = k + 1;
    end
    if(ordered1(k)~=tempnum)
        output = [output;[(count/537),tempnum]];
        k = k + 1;
        tempnum = ordered1(k);
    end
end

The errors I'm getting look like this

??? Error using ==> vertcat
CAT arguments dimensions are not consistent.

Error in ==> lab8 at 1164
        output = [output;[(count/537),tempnum]];

The line to add to the output matrice was given to me by my TA. He didn't teach us much syntax throughout the year so I'm not really sure what I'm doing wrong. Any help is greatly appreciated.

© Stack Overflow or respective owner

Related posts about matlab

Related posts about matrix