|
I've found the answer, and that's so simple that I am embarrassed of
having asked. It's just to put the SR inside SR, like sr=[sr,st,r];
right? Thank you all. very much
On 31 Jan 05 15:02:03 -0500 (EST), Karina Neves wrote:
>I am doing
>function SR=S(I)
>I= [16 0 2 13; 0 0 -11 8; 9 6 7 0; 4 15 0 1];% matrix example
>zeros = 0;
>for z = I(1:16) %I don'nt know how to put it like for z= I(a11:aij)
> if z == 0 %if the elemente is equal zero
> zeros = zeros + 1; % add one in zeros
> else
> st = z; %else reads the element
> r = zeros; %reads the amount of zeros
> SR=[st,r] % stores the values in a vector
> zeros = 0;
> end
>end
>the problem is that the vector SR doesn't keep all the values, it
just
>saves the last one, could anyone help me? I know it's dumb, but I
>don't know how to solve it! Thanks.
|