MATLAB: How to create a .txt file in matlab to report mt output

file

Now, I have 5 outputs and i want to create a .txt file to report my outputs. The content should be these 5 sentences. How can i do that?

Best Answer

From fprintf, use fopen to create (or open) a file and write to it as
fid = fopen('myDataFile.txt', 'w+');
fprintf(fid, 'The price of N a is %f\n', A);
% etc.
fclose(fid);