matlab for loop array code example
Example 1: iterate through array matlab
for i=1:len(array)
The body of the loop goes here
end
Example 2: matlab for loop matrix
m=zeros(1,length(t)); %array of zeros
for i=1:length(t) %filling peicewise function
if(t(i)>=0 && t(i)<0.1)
m(i)=10*t(i);
else
m(i)=0;
end
end % for