help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alternative missing values in readcsv?


From: Jordi Gutiérrez Hermoso
Subject: Re: Alternative missing values in readcsv?
Date: Tue, 16 Feb 2010 09:26:24 -0600

On 16 February 2010 09:15, forkandwait <address@hidden> wrote:
>> How about
>>
>>      A(find(isnan(A))) = 0
>>
>> after you've read into A from your CSV file?
>
> Often nan signifies something completely different from zero, and you would
> lose this information.  For example, a column might be how much you earned,
> with nan signifying not in the labor force, but zero signifying you earned,
> well, zero.  Which is different.

I'm sorry. I read your problem backwards. You want to change zeros to
nans, not nans to zeros. I presume you're using the dlmread function?
In that case, it doesn't seem like it comes with what you want. But
it's very easy to fix your file so that dlmread reads nans instead of
zeros:

     s/,,/,nan,/g your_file

in sed or Perl will do it, or just open it in any text editor and
replace ,, with ,nan,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]