What is the best way to save data into a txt file

135 vues (au cours des 30 derniers jours)
will99
will99 le 21 Mar 2019
Commenté : will99 le 22 Mar 2019
I have these data in a matrix and I want to save them into a txt file
but I got diffrenet values than what in my matrix it was something like this (in that format)
4.6998106645411053e+02
I used save fuction to try and save my data I want to save is there another way to save data into txt file?
save('new doc.txt','M','-ascii','-double','-tabs') % M is the matrix
type('new doc.txt')
6540601141.61867 13577823444.2938 28101317825.1798
7569519373.48601 15264346993.3944 30754547025.5567
7387340146.18493 15158865708.5425 31019062144.9410
6251317371.90850 12958424682.6582 26803084252.4354
6734644847.83862 13687649437.8130 27810201085.8812
6849537690.44554 14134553528.2659 29089340966.3231
7385568328.07828 15044694671.3799 30591374573.0212
6381280737.62946 12989993198.7250 26448459532.9256
  3 commentaires
will99
will99 le 22 Mar 2019
I was trying to save it in txt file is fprintf the best way for txt format?

Connectez-vous pour commenter.

Réponse acceptée

madhan ravi
madhan ravi le 22 Mar 2019
If your using 2019a you may try the newly introduced writematrix().
  1 commentaire
will99
will99 le 22 Mar 2019
Thank you I have Matlab 2018b but I will update it and try the new function

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Text Data Preparation dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by