save a data as mat file

1 次查看(过去 30 天)
Rica
Rica 2012-11-6
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

采纳的回答

José-Luis
José-Luis 2012-11-6
编辑:José-Luis 2012-11-6
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 个)

类别

Help CenterFile Exchange 中查找有关 Repeated Measures and MANOVA 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by