[Solved] How many elements the output matrix should have in this code? [closed]


You have put the k=k+1 at a wrong place. It is the correct code:

stab1=zeros(1,4991);
k=0;
for ii=-0.6:0.01:-.3
m=0;
    for jj=0:0.01:1.6
    m=m+1;

    if .... (some condition)
    stab1(k*161+m)=1;
    end


    end
 k=k+1; 
 end

Now it has 4991 elements.

solved How many elements the output matrix should have in this code? [closed]