Convert fig into csv, txt or ascii
21 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have the m-file on generating all the graphs in .fig I need with a for loop, but I don't know how to extract the array data to csv, txt or ascii format (16-bit).
imagesc(x,y,C); %C is the data I want to extract
%m and n are variables created inside the for loop
I have tried dlmwrite and save, but I failed and could not fix the problem.
So I want to convert fig into csv, txt or ascii format instead.
filename_B=strcat(MM,'_profile'); %MM is a variable created inside the for loop
dlmwrite(filename_B.txt,squeeze(Data_time(:,m,n,:)),''); %Data_time is C
save(filename_B, squeeze(Data_time(:,m,n,:)),'-ascii','-double');
It would be better if I could just extract the data directly to the desirable format without first producing fig then convert.
For confidential issue, I can't provide the whole script, but I will try my best to explain my problem.
Many thanks!
0 Kommentare
Akzeptierte Antwort
Adam
am 8 Sep. 2015
I've never used it myself but there is a
doc csvwrite
function that sounds like it does what you want with respect to writing to csv.
doc fprintf
will write to a text file too if you specify it correctly.
3 Kommentare
Walter Roberson
am 9 Sep. 2015
csvwrite('filename_B.txt', squeeze(Data_time(:,m,n,:)));
or if filenme_B is a string,
csvwrite([filename_B '.txt'], squeeze(Data_time(:,m,n,:)));
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!