This is a quick tutorial for doing the basics in MATLAB.
Author(s): Mark A. Tschopp
Let's try some looping examples, i.e.,
for i = 1:3 a(i) = i^2; end > a a = [1 4 9]
or use if, then, else statements
for i = 1:3 if i == 1 disp('i = 1') elseif i == 2 disp('i = 2') elseif i == 3 disp('i = 3') else disp('i > 3') end end