How do you output a line break in the command view in Matlab when running a m-file?
fprintf('\n')
should do the trick, likewise disp(' ')
. In general, fprintf
is more flexible than disp
. The main advantage of disp
is that it has some intelligence and knows how to print out complete objects.
You can also disp a the line break character '\n' with its decimal value: 10.
disp(char(10))
or
disp(['line 1' char(10) 'line 2'])