How to save a matrix as text file?
Afficher commentaires plus anciens
I want to save a matrix as text file.
Each column should be separated by tab.
The output file should be read with any text editor
When the output is opened, it should display the numbers
in the same way it looks like in Matlab.
Thank you for your help
Emerson
Réponse acceptée
Plus de réponses (3)
Sean de Wolski
le 28 Mar 2011
doc dlmwrite
doc fwrite
2 commentaires
Bill Tubbs
le 13 Juil 2019
Walter Roberson
le 13 Juil 2019
writematrix() did not exist in 2011 when the answer was posted.
Walter Roberson
le 16 Déc 2017
You could also consider dlmwrite telling it to use \t as the delimiter.
You could also consider using
save('MyMatrix.txt', 'A', '-double', '-tab')
Where A is the name of the variable
3 commentaires
Should be:
save('MyMatrix.txt', 'A', '-ascii', '-double', '-tabs')
Jairo C Peralta
le 5 Fév 2019
what is the "double" part for?
Walter Roberson
le 5 Fév 2019
double precision. Without the -double only about 7 digits are written out, about as much as needed to reproduce single precision numbers.
Anmar Mohammed
le 16 Déc 2017
0 votes
thank you very much sir
Catégories
En savoir plus sur File Operations dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!