[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dlmread only returns empty matrix
From: |
Gerald Ebberink |
Subject: |
Re: dlmread only returns empty matrix |
Date: |
Wed, 13 Sep 2006 17:03:40 +0200 |
After reading this I think I'll have to checkout either the new octave
or the new octave forge, because my version of dlmread does not accept
more than 3 arguments.
On Tue, 2006-09-12 at 16:35 -0400, Przemek Klosowski wrote:
> You are using dlmread() to skip first three lines, but in that case it
> needs two numbers (row and column of the first number to read).
> Appending a zero argument to your arglist my octave v. 2.9.8 gives:
>
> F=dlmread('/tmp/test.d',';',3,0)
> F =
>
> 0 1 5 0 0 0
> 0 2 4 0 0 0
> 0 3 5 0 0 0
> 0 4 0 7 0 0
> 0 5 0 7 0 0
> 0 6 0 7 0 0
>
> Now, you have some numbers here like 5,68029. Are you using decimal
> comma numeric separator? it may be, because one of the numbers is
> 5,06032 and the leading zero makes more sense in this case. I wonder
> if your locale settings make it work in such case; I tried
>
> LC_NUMERIC=',' octave
>
> wherease getenv("LC_NUMERIC") returned ',' but the values read by
> dlmread didn't change.
>
> If the comma is an alternative separator, it's a little more difficult
> because dlmread does not allow regexpressions for the split symbol.
> One way around it would be to re-read the file with a different split
> character: F2=dlmread('/tmp/test.d',',',3,0), or even better, use the
> full range and read it directly into the F array read in the first step:
>
> F(:,5)=dlmread('/tmp/test.d',',',[3,1,8,2])
> F =
>
> 0 1 5 0 68029 0
> 0 2 4 0 49062 0
> 0 3 5 0 6032 0
> 0 4 0 7 13333 0
> 0 5 0 7 16667 0
> 0 6 0 7 16667 0
>
>
>
>
> I have been using your test file:
>
> Image Name;ID;Vertical Line;Horizontal Line
> ; ;Length;Length
> ; ;mm;mm
> Tv11;1;5,68029;
> Tv11;2;4,49062;
> Tv11;3;5,06032;
> Tv11;4;;7,13333
> Tv11;5;;7,16667
> Tv11;6;;7,16667
--
NCLR B.V.
Visiting address Postal address
Drienerlolaan 5 PO box 2662
7522 NB Enschede 7500 CR Enschede
Netherlands Netherlands
Phone : (+31) (0)53-489 11 10 - Fax : (+31) (0)53-489 11 02
Direct line (+31) (0)53-489 39 61