save a data as mat file
7 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
José-Luis
on 6 Nov 2012
Edited: José-Luis
on 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
0 Comments
More Answers (0)
See Also
Categories
Find more on Large Files and Big Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!