fid = fopen('mydata.txt', 'r'); tline = fgetl(fid); k=1;
while ischar(tline) disp(tline) findrows = strfind(tline, 'ARR++'); if ~isempty(findrows) Data{k,:} = tline(:); k=k+1; end tline = fgetl(fid); end
fclose(fid);
filename = 'mydata_1.txt';
cell2text(filename,Data);
%open file fid = fopen(filename, 'r'); %figure out how many columns are there firstline = fgetl(fid); ncol = 1 + sum(firstline == ':'); %reset to beginning of file fseek(fid,0,0); %read data data = textscan(fid,repmat('%s',1,ncol),'Delimiter',':','CollectOutput',1); data = data{:,:}; data = data(:,[3:7 9:12 14 16]);
[m,n]=size(data);
for i = 1:m data1{i,9} = data{i,9}(1:5); data{i,9} = {}; data{i,9} = data1{i,9}; end
%close file fclose(fid);
Best Answer