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?

 Réponse acceptée

Star Strider
Star Strider le 28 Août 2016

0 votes

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.

Plus de réponses (1)

Andy Hutchinson
Andy Hutchinson le 28 Août 2016

0 votes

Cheers mate.

Catégories

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by