How can I save the outputted string (retaining tabs/added lines) to a .txt file?
MESSAGE = sprintf('Var1 is %g.\nVar2 is %g.', X, Y);disp(MESSAGE)
In the Command Window, disp(MESSAGE) outputs:
X is 2.24.
Y is 3.33.
MATLABsavefilesprintftxt
MESSAGE = sprintf('Var1 is %g.\nVar2 is %g.', X, Y);disp(MESSAGE)
Best Answer