how can i print numbers like i want

3 views (last 30 days)
eyyüp er
eyyüp er on 22 May 2020
Commented: Walter Roberson on 23 May 2020
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 ?

Answers (1)

Walter Roberson
Walter Roberson on 22 May 2020
fid = fopen('YourFile.txt', 'wt');
fprintf(fid, '%10g %10g\n', A');
fclose(fid)
  2 Comments
eyyüp er
eyyüp er on 22 May 2020
when i trying your answer, it seem like it :(
Walter Roberson
Walter Roberson on 23 May 2020
the code I posted would not create that output. That output would be more like '%g %10g'

Sign in to comment.

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!