how can i print numbers like i want
3 views (last 30 days)
Show older comments
the is my codes i have an array like A=[0 294300;0.1 293319;0.2 292338] and it seems in command window like:
0 294300
0.1 293319
0.2 292338
but when i trying to writing this array to txt file it seems like in txt file:
0 294300
1.000000e-01 293319
2.000000e-01 292338
how can i the writes the numbers to txt file as i see in command window ?
0 Comments
Answers (1)
Walter Roberson
on 22 May 2020
fid = fopen('YourFile.txt', 'wt');
fprintf(fid, '%10g %10g\n', A');
fclose(fid)
2 Comments
Walter Roberson
on 23 May 2020
the code I posted would not create that output. That output would be more like '%g %10g'
See Also
Categories
Find more on Large Files and Big Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!