Why textscan inserts 0 instead of NaN ?

Hello,
I use textscan to import a text file which is a mixture of number and strings. The format is like:
VGAHFID,VGALFID,SN_hd
63484,49736,S410060Y_0
54696,54744,S410060Y_0
,,S410060Y_0
53092,54512,S410060Y_0
53716,54568,S410060Y_0
53800,54768,S410060Y_0
The command I used is a = textscan(fid,'%d%d%q','Headerlines',1,'Delimiter',',','EmptyValue',NaN);
Here's the result.
>> a{2} ans =
49736
54744
0
54512
54568
54768
If I changed the NaN to Inf, the missing value will be replaced with 2147483647.
I guess it must be my "a" format issue. But don't know how to solve it.
Thanks, Jane

1 Kommentar

Jane
Jane am 23 Okt. 2014
Never mind. I checked NaN, it is double. So once I changed the format to %f, the NaN showed up.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 23 Okt. 2014

Kommentiert:

am 23 Okt. 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by