Info

This question is closed. Reopen it to edit or answer.

Formatting Array column in fprintf

1 view (last 30 days)
Trang Hu Jia
Trang Hu Jia on 27 Oct 2020
Closed: Stephen23 on 27 Oct 2020
Hello everyone,
I have using the command of fprintf to create data .dat file as
1 0.000000 0.000000 0.000000
2 0.000000 0.000000 4.000000
3 0.000000 0.000000 1.000000
4 0.000000 0.000000 2.000000
5 0.000000 11.000000 4.000000
6 0.000000 12.000000 4.000000
7 0.000000 13.000000 4.000000
8 0.000000 14.000000 4.000000
9 0.000000 15.000000 4.000000
10 10.000000 16.000000 4.000000
11 10.000000 17.000000 4.000000
12 0.000000 18.000000 4.000000
13 0.000000 12.000000 0.000000
14 0.000000 11.000000 0.000000
15 0.000000 10.000000 0.000000 etc.
Now i want to re-arrange to the same format as
1 0.0000000 0.0000000 0.0000000
2 0.0000000 0.0000000 4.0000000
3 0.0000000 0.0000000 1.0000000
4 0.0000000 0.0000000 2.0000000
5 0.0000000 11.000000 4.0000000
6 0.0000000 12.000000 4.0000000
7 0.0000000 13.000000 4.0000000
8 0.0000000 14.000000 4.0000000
9 0.0000000 15.000000 4.0000000
10 10.000000 16.000000 4.0000000
11 10.000000 17.000000 4.0000000
12 0.0000000 18.000000 4.0000000
13 0.0000000 12.000000 0.0000000
14 0.0000000 11.000000 0.0000000
15 0.0000000 10.000000 0.0000000 etc.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!