file - Remove lines from a .txt with a certain character in MATLAB -
i working on project data of magnitude of variable stars , have come across problem:
the data have in .txt document has lot of comments marked symbol #
, know if there way read whole text , take lines not include particular character, have read whole text , put array:
fid=fopen('000006+2553.txt','r'); i=1; while 1 tline=fgetl(fid); if ~ischar(tline), break, end a{i}=tline; i=i+1; end
but there don't know how follow.
just add a
if tline(1)=='#', continue, end
to loop. that's quite standard snippet.
note check first character on purpose, have come across data files contain comments after data in same line. (valid) string fields might include character.
Comments
Post a Comment