MATLAB: How to display newline

newline

Can you use newline seperately or do you always have to use it in fprintf in order to make it work. Theese are my attempts with newline:
this did not work:
This gave a strange result
Is this the only way to make a newline?:
Here is my script for the last line:
rows=3;
columns=5;
for i=1:rows
for j=1:columns
fprintf('*')
end
fprintf('\n')
end

Best Answer

Hi, '\n' by itself outside of special calls is just interpreted as the string (character array) \n
It's not just in fprintf(), sprintf() also interprets escape characters correctly like \n or \t
but yes you're right:
disp('Hi \n nice to meet you')
% produces Hi \n nice to meet you
but
fprintf('Hi \n nice to meet you')
% Hi
% nice to meet you>>