MATLAB: Why in the function below the ‘if’ statement does not have an ‘end’ line. the program runs normaly.

elseendfunctionifnormalyruns

Best Answer

The 'end' at the very bottom of your posted image is being interpreted by Matlab as the end of that if...else block.
Perhaps you thought that all functions need closing 'end' statements. That's not always true, see
>> doc function
>> doc end
as well as,
Related Question