fprintf reading rows not working right...
Show older comments
Hello all!
Well I'm just not getting something, I'm sure its easy, but just not figuring it out. I'm just trying to read the rows and write them into a file. so the first row of the txt file should be 2 5 25 48 53, but that is not what I'm getting, I'm gettiing 2 14 11 9 4 4, well please help! Thanks, Here is the code:
nums = [2 5 25 48 53;
14 16 18 19 9;
11 31 4 44 52;
9 12 47 48 56;
4 14 29 4 56;
4 16 36 40 3;
1 22 39 2 46;
1 12 21 9 45;
14 6 17 33 7;
2 17 20 26 4;
10 20 45 1 3;
6 7 6 27 9;
1 0 22 23 8;
7 8 38 39 8];
fileID = fopen('Example.txt','w');
fprintf(fileID,'%1i\t %1i\t %1i\t %1i\t %1i\t %1i\n',nums);
fclose(fileID);
Accepted Answer
More Answers (0)
Categories
Find more on Low-Level File I/O 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!