[ACCEPTED]-Displaying information from MATLAB without a line feed-disp

Accepted answer
Score: 27

The fprintf function does not add a line 7 feed unless you explicitly tell it to. Omit 6 the fid argument to have it print to the 5 Command Window.

fprintf('Doing stuff... ');
for i = 1:5
    fprintf('%d ', i);
    % do some work on that pass...
fprintf(' done.\n'); % That \n explicitly adds the linefeed

Using sprintf won't quite 4 work: it creates a string without a line 3 feed, but then if you use disp() or omit 2 the semicolon, disp's own display logic 1 will add a line feed.

More Related questions