Saving data to a file and getting giberish

3 vues (au cours des 30 derniers jours)
JC
JC le 27 Juil 2020
Modifié(e) : Image Analyst le 28 Juil 2020
I am trying to save two columns of numbers to a file, right now its a txt file but when I open the file its just a bunch of nonsense.
my code is below
fileID = fopen(filename);
a = textscan(fileID,'%u');
b = {a,a};
c =[b{1,1}{1,1},b{1,2}{1,1}];
d = double(c);
save('test.txt', 'd')

Réponses (1)

Image Analyst
Image Analyst le 28 Juil 2020
Modifié(e) : Image Analyst le 28 Juil 2020
That's the proprietary MAT file format. If you want text, try the -ascii option
save('test.txt', '-ascii', 'd')
or else use fopen(), fprintf(), and fclose().

Catégories

En savoir plus sur Data Import and Analysis dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by