It is often faster and easier just to read in all of the data from a file, then then use simple indexing to pick the bits that you need. This will read the first part of the file:
opt = {'CollectOutput',true};
fid = fopen('trial.txt','rt');
C_date = textscan(fid,'%f%f%f%f%f%f%*s',1,'HeaderLines',5,opt{:});
for k = 1:4
C_lat(k,:) = textscan(fid,'%f%f%f%f%f%*s',1,'Delimiter','- ',opt{:});
C_map(k,:) = textscan(fid,repmat('%f',1,16),5,opt{:});
end
fclose(fid);
Best Answer