Wrap strings with sprintf to allow the \n to be escaped correctly.

>> disp('hello\nworld')
hello\nworld

>> disp(sprintf('hello\nworld'))
hello
world