I have a problem with writing data to a file in Matlab, I have an LP problem that their solution is a vector of size n, and I want to write some information about this solution in a text file to read it any time I want, (I don not want to save workspace in matlab) I write the following code
n = 5;
Length = 10;
s = [1;0;1;0];
t = 0.6;
Test = fopen('Test.txt', 'w');
fprintf(Test,'TSP Problem Size is: %d \n', n);
fprintf(Test,'Optimal Length is: %.5f \n', Length);
fprintf(Test,'Time To Solve in seconds is: %f \n', t);
fprintf(Test,'Solution is: \n');
for i=1:size(s)
fprintf(Test,'%.0f\n', s(i));
end
fclose(Test);
and when I execute 'type(Test.txt);' it appears as I want but when I open file in windows explorer it appears all as one line, I don't know why ??? is there any way to keep formatting and to write the solution every value in a separate line (I try dlmwrite but it writes only matrix, I need to write some information then the matrix)
thank you for your help