David Bateman wrote:
> Jonathan Stickel wrote:
>> I just checked in an improved dlmread function (dlmreadnew.cc) into the
>> io/src folder. It should properly respect your delimiter, converting
>> empty fields to zero. Unequal row lengths are allowed. Since it is a
>> compiled oct-file, it is very fast. I made an effort to be compatible
>> with Matlab as determined from the online help.
>>
> I see no reason not to replace the original dlmread with this version..
> Note that I believe there are a couple of errors.
> First a file like
>
> # This is a header
> # C1 C2 C3
> 1, 2, 3
> 4, 5, 6
>
> read with dlmread("foo.dat",2,0) should completely ignore the header, so
> your extraction code should be split into two bits..
>
> There are also a number of weird cases like blank lines and double
> separators that need to be taken into account. We should also try and
> avoid resizing the matrix as that is an expensive operation. Adding the
> complex matrices to your code is fairly trivial, though it would be
> better to get rid of the strdup/strtok_r/strtod functions and use pure
> C++ code. What I would therefore suggest is something like the attached.
>
Great! Thank you for your additions. I am a self-taught novice c++
programmer at best and am glad for the input. Based on some simple
tests, it looks like your version works fine.
> Note that as dlmread is a core function this should be move to Octave
> itself, and this is a good start. I therefore tried to use the Octave
> style in the changes I made.
>
Yes, I think dlmread should move into core octave. Might as well move
csvread into core octave also since it is just a wrapper to dlmread.
There still exists another dlmread m-file in octave-forge. Unless there
is a good reason not to, I think it should be deleted.
Regards,
Jonathan
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev