Effacer les filtres
Effacer les filtres

TEXTSCAN problem using TREATASEMPTY

5 vues (au cours des 30 derniers jours)
Jeremy Smith
Jeremy Smith le 21 Juil 2011
Commenté : Jeremy Hughes le 20 Nov 2017
D = textscan(fid,'%q%f%f%f%f%f%f%f%f%f%f%f%f%f%f','Delimiter',',','HeaderLines',4,'TreatAsEmpty',{'"NAN"','"INF"','"-INF"','"1.#INF"','"-1.#IND"','"#NAME?"'});
This fails.
D = textscan(fid,'%q%f%f%f%f%f%f%f%f%f%f%f%f%f%f','Delimiter',',','HeaderLines',4,'TreatAsEmpty',{'"NAN"'});
This works.
The file in question looks much like the following line.
"2011-04-19 11:55:30",521882,1,25.5,347.068,3.765646,1.54899,18.43283,204.205,125.9697,10,651.2458,9.310149,"NAN","NAN"
The last two columns are all "NAN" values. When using the first code example Matlab loads all data except for the very last value. If the very last value is replaced by a number it loads everything.
What is going on with TEXTSCAN?
  1 commentaire
Jeremy Hughes
Jeremy Hughes le 20 Nov 2017
Try adding
'ReturnOnError',false
to get a better diagnostic of why textscan stops there.

Connectez-vous pour commenter.

Réponses (0)

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!

Translated by