Putting a matrix with no breaks
6 views (last 30 days)
Show older comments
Andy Hutchinson
on 28 Aug 2016
Commented: Star Strider
on 28 Aug 2016
I have a matrix size 380 by 24. However, it breaks it up! i.e it reads ''columns 19 through 24'' which is inconvenient for me. I can change this by using num2str but I don't want my data in strings. Any ideas?
0 Comments
Accepted Answer
Star Strider
on 28 Aug 2016
It only ‘breaks it up’ in the Command Window when you display it. The matrix itself is numeric, complete and intact in your workspace.
If you want to write it to the Command Window without breaking it between columns, use fprintf:
M = randi(99, 380, 24); % Your Matrix
fprintf(1, [repmat(' %9.5f', 1, 24) '\n'], M') % Command Line Display
Note that you have to transpose (') the matrix in the fprintf call.
0 Comments
More Answers (1)
See Also
Categories
Find more on Matrix Indexing 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!