help-octave
[Top][All Lists]
Advanced

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

Re: Including NaNs in a data file?


From: Doug Stewart
Subject: Re: Including NaNs in a data file?
Date: Wed, 5 Nov 2014 08:28:37 -0500



On Wed, Nov 5, 2014 at 7:55 AM, Alasdair McAndrew <address@hidden> wrote:
I'm setting up a matrix of student marks; using NaNs for non-existent data: a question not attempted.  I'd like to be able to store this as ascii text outside of Octave, with a row looking something like

5 2 N 3 4 N N 3 6 4

the N's indicating questions not attempted.  I can read this into Octave with "fileread", and I get a long string, which I can then fiddle with to turn into numeric values and NaNs.  The function "dlmread" is more convenient, but converts all non-numeric data to zeros.

Is there an easy way to store NaNs in an ascii file, and how then can that file be best read into Ocatve?

Thanks,
Alasdair


a =

     1     2   NaN     4     6


>> save -ascii a.txt a
b=load('a.txt')
b =

     1     2   NaN     4     6

>>
--
http://www.facebook.com/alasdair.mcandrew https://plus.google.com/+AlasdairMcAndrew/posts https://www.linkedin.com/pub/alasdair-mcandrew/a/178/108 https://twitter.com/amca01 http://numbersandshapes.net

_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave




--
DASCertificate for 206392


reply via email to

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