hi guys , i want to read a text file line by line and remove the lines which have NA and the duplicated columns
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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);
1 commentaire
Réponse acceptée
dpb
le 15 Fév 2017
Modifié(e) : dpb
le 16 Fév 2017
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Large Files and Big Data dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!