How to write matrix to txt or excel file with specific precision
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ahmad eldeeb
am 7 Okt. 2018
Bearbeitet: Stephen23
am 7 Okt. 2018
I have a 100*100 matrix that I need to save it in a txt or excel file with high precision. This the code I use:
fid = fopen('data.txt', 'w+');
for j = 1:size(s, 2)
for i = 1:size(s, 1)
fprintf(fid, '%2.20f \n', s(i,j));
end
end
The problem in the output, it saves all the values in one line. Any ideas.
2 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Environment and Settings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!