If else statement matlab
if expression, statements, end evaluates an expression, and executes a group of statements when the expression is true.
Example
for i = 1:20 if i == 10 % checking if clause disp('inside 10') % printing message inside 10 break % breaking out from loop else disp(i) % printing i value end end
Output
1 2 3 4 5 6 7 8 9 inside 10