[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: TEXTREAD is broken (again) ?
From: |
Søren Hauberg |
Subject: |
Re: TEXTREAD is broken (again) ? |
Date: |
Thu, 22 Apr 2010 09:53:56 -0700 |
tor, 22 04 2010 kl. 17:00 +0200, skrev Tribo Laboy:
> I am trying to import some mixed data into Octave. I am using Octave
> 3.2.4 MinGW32 from SF.net.
>
> The data is in a file called: "testfile.csv", which has this format:
>
> 1,pretest,1,10.0051348436
> 2,posttest,2,10.0051348436
> 3,posttest_plus16h,3,10.0051348436
> 4,pretest,1,20.0102696873
> 5,posttest,2,20.0102696873
> 6,posttest_plus16h,3,20.0102696873
> 7,pretest,1,50.0256742182
> 8,posttest,2,50.0256742182
> 9,posttest_plus16h,3,50.0256742182
>
> I use TEXTSCAN and it spits out an error like this:
> >>> [a,b,c,d] = textread("testfile.csv","%f,%s,%f,%f")
> >>>error: value on right hand side of assignment is undefined
>
> I search on the web and I find that in Mercurial there is a new
> function TEXTREAD and it comes with a companion function STRREAD.
> Here:
> http://hg.savannah.gnu.org/hgweb/octave/rev/31a22d48f41f
> How nice!
>
> After downloading and renaming the file to TEXTIMPORT (and all the
> occurrences of 'TEXTREAD' within it), now I try the same thing:
I tried your example in Matlab and got
??? Error using ==> dataread
Trouble reading literal string from file (row 1, field 4) ==> \n
Error in ==> textread at 176
[varargout{1:nlhs}]=dataread('file',varargin{:});
I'm not sure what syntax you should be using to read your specific
format. (I never managed to quite understand the 'textread' syntax even
though I implemented large parts of the current code...)
> 2. Isn't it about time to get a decent function for reading mixed data
> into Octave?
This is not a good way to make new friends... (please consider using a
more friendly language when posting here)
> Regarding the second point I am ready to contribute the hack on
> READTEXT that I did, but there are several points to consider:
> a) I am not sure about the licensing compatibility. READTEXT is BSD.
> b) I am a Matlab, not Octave programmer, so the help part and the
> built-in tests of an octave M-file are a complete mystery to me.
> Hence, my files will not be directly suitable for inclusion in Octave
> or Octave-forge.
The license should not be an issue as BSD is GPL compatible. If you post
code, then we can take discuss things from there.
Cheers
Søren