clcclear all k=4; a=13;for i=1:10 c(i)=i*k; b(i)=a+c(i);endfor i=1:10if 26<b<39 e=b+k;else e=b/k;endenddisp(e)disp(c)disp(b)
MATLAB: If-else within for loop
elsefor loopif statementMATLAB and Simulink Student Suite
elsefor loopif statementMATLAB and Simulink Student Suite
clcclear all k=4; a=13;for i=1:10 c(i)=i*k; b(i)=a+c(i);endfor i=1:10if 26<b<39 e=b+k;else e=b/k;endenddisp(e)disp(c)disp(b)
Best Answer