save a data as mat file

7 visualizaciones (últimos 30 días)
Rica
Rica el 6 de Nov. de 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

Respuesta aceptada

José-Luis
José-Luis el 6 de Nov. de 2012
Editada: José-Luis el 6 de Nov. de 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

Más respuestas (0)

Categorías

Más información sobre Large Files and Big Data en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by