hi guys , i want to read a text file line by line and remove the lines which have NA and the duplicated columns
1 次查看(过去 30 天)
显示 更早的评论
d = fopen('COADREAD_methylation.txt','r');
this_line=0;
all={};
while this_line~=-1
% C= textscan( d, '%f%s' ) ;
this_line=fgetl(d);
if this_line~=-1
all=[all;this_line];
end
end
fclose(d);
采纳的回答
dpb
2017-2-15
编辑:dpb
2017-2-16
Well, 'NA' is easy, not sure what defines the repeated columns; not enough time at present to try to parse that input file to figure out what is/isn't unique without a description being supplied...
fid = fopen('COADREAD_methylation.txt','r');
data={};
while ~feof(fid)
l=fgetl(fid);
if isempty(strfind(l,'NA')), data=[data;{l}]; end
end
fid=fclose(fid);
If the presence of 'NA' is all that's needed to get all the offending records, then you're done; otherwise need more details on how to tell so folks here don't have to try to work it out on their own.
13 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Large Files and Big Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!