textscan gives me wrong number of lines
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have a file names inputR_revised.tsv at https://www.dropbox.com/s/vtby4027rvprhga/inputR_revised.tsv?dl=0 In matlab, I typed
fid=fopen('BMC3C/example/inputR_revised.tsv','r')
covTable = textscan(fid,['%s',repmat('%.8n',[1,20])],'HeaderLines',1);
I get covTable{1,1} of size 41699 times 1. However when I type the following at terminal
wc -l inputR_revised.tsv
I get 41677. Why does it differ? I have used sed and cut to modify the original file to get inputR_revised.tsv. Is this the reason?
Is there a way to fix this?
0 comentarios
Respuestas (1)
dpb
el 12 de Nov. de 2018
In
covTable = textscan(fid,['%s',repmat('%.8n',[1,20])],'HeaderLines',1);
you set the 'HeaderLines' option to True (1) so the first line is being ignored by textscan and read as a header, not data. If it is actually data instead, then
covTable = textscan(fid,['%s',repmat('%.8n',[1,20])],'HeaderLines',0);
will fix that (or error if it really is a header, one; we can't tell whether it is or isn't).
2 comentarios
Ver también
Categorías
Más información sobre Large Files and Big Data en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!