Recognizing and removing unwanted lines from data file
Mostrar comentarios más antiguos
Hey all,
After way to many hours of trial and error, and looking on the web for an answer I've ran out of options. I'm pretty sure you guys should be able to solve this problem for me since it doesn't seem that complicated.
I have a couple thousands of data files with a format like this:

I want Matlab to give me the values in the matrices, (so in the first matrix [0.75 55.0; 1.00 55.0; 1.25 86.3].
I've succeeded in writing code that will give me the first matrix, but i havent been able to textscan in such a way that it skips the unwanted lines.
d=[];ssc=[];
files = dir([datdir 'MV2*']);
for j=1:length(files)
fid = fopen([datdir files(j).name],'rt');
C=textscan(fid,'%f %f','Delimiter','\n');
fclose(fid);
d=[d;C{1}];
ssc=[ssc;C{2}];
end
Some advice or a solution would be amazing! Thanks in advance :)
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Import and Export en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!