help-octave
[Top][All Lists]
Advanced

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

Re: dlmread only returns empty matrix


From: Przemek Klosowski
Subject: Re: dlmread only returns empty matrix
Date: Tue, 12 Sep 2006 16:35:34 -0400 (EDT)

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


reply via email to

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