[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: handling strings
From: |
Stefan van der Walt |
Subject: |
Re: handling strings |
Date: |
Tue, 13 Sep 2005 20:42:08 +0200 |
User-agent: |
Mutt/1.5.9i |
On Tue, Sep 13, 2005 at 10:42:21AM -0500, Mike Miller wrote:
> On Tue, 13 Sep 2005, Stefan van der Walt wrote:
>
> >To read in the data, you might want to take a look at 'textread' in
> >octave-forge (recently, a C++ version was submitted).
> >
> >It shouldn't be difficult to modify it to do your string comparisons as
> >well.
>
>
> Very nice! It does work well for me. I am actually using it to read in
> pedigree data for genetic analyses. When sex is designated by integers
> (usually 1=male, 2=female), this seems to always work very nicely:
>
> [fam,indiv,father,mother,sex] = textread("file.ped", "%s %s %s %s
> %d%*[^\n]");
>
> After that, a series of strcmp commands can be used to do the work of
> recoding fam, father and mother.
>
> One oddity is that sex (the %d column) becomes a row vector instead of a
> column vector. That's OK now that I know about it, but I think it would
> make more sense for columnar data to be stored by default in column
> vectors.
Are you using the newest version? It should be an oct-file. It is
much quicker than the old version, slightly more limited, and follows
the MATLAB interface.
Regards
Stéfan
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------