MATLAB: Save a string consisting of data to another directory MATLABsave I want to save a string consisting data to another directory.. c = sprintf('Power Factor=%.2f, PL=%g, FG=%g, Angle=%g, Nt=%g.mat', QM1, PL, FG, Ang_A, Nt); How can I save c to the D:\Sim Results directory ? Best Answer See fprintf(): https://www.mathworks.com/help/matlab/ref/fprintf.html f = fopen('D:\Sim Results\filename.txt')fprintf(f, 'Power Factor=%.2f, PL=%g, FG=%g, Angle=%g, Nt=%g.mat', QM1, PL, FG, Ang_A, Nt);fclose(f);
Best Answer