save a data as mat file

7 vues (au cours des 30 derniers jours)
Rica
Rica le 6 Nov 2012
Hi
%
%
for i=113:113
data=[];
fileID = fopen(['Printout_' num2str(i) '.txt']);
block = textscan(fileID, '%s','Delimiter','\n');
data=[data; block];
fclose(fileID);
compact_data=vertcat(data{:});
compact_data(1:29:end)=[];
compact_data(1:28:end)=[];
result_file=fopen(['result_probe_' num2str(i) '.txt'],'w');
fprintf(result_file,'%s\r\n',compact_data{1:1:end});
clear all
end
thank you for the fast response. but how could i do it as whe the loop is going from 113 to 200. it means somthing like this:
maymatlabefile113.mat
maymatlabefile114.mat
maymatlabefile115.mat
maymatlabefile116.mat ... . . .maymatlabefile200.mat

Réponse acceptée

José-Luis
José-Luis le 6 Nov 2012
Modifié(e) : José-Luis le 6 Nov 2012
I would recommend putting everything in a cell array, that you can then save.
all_data = cell(10,1);
for ii = 1:10
all_data(i) = {your_data};
end
save your_file.mat your_data;
Having all those files can lead to problems. However, here is a solution
nameStr = 'your_file';
for ii = 1:10
tempStr = [your_file num2str(ii) '.mat'];
save(tempStr ,'your_data');
end

Plus de réponses (0)

Catégories

En savoir plus sur Large Files and Big Data 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