help-octave
[Top][All Lists]
Advanced

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

Re: how to debug octave code?


From: frank wang
Subject: Re: how to debug octave code?
Date: Thu, 24 Aug 2006 17:44:30 -0700

Hi, John,
 
Firstly, I have to state that I am using octave 2.9.7 and I compiled by myself in SUSE 10.1 with gcc 4.1.0. I am running octave in SUSE 10.1 linux.
 
To answser you the first question, I have tried to load the file with CRLF or LF without success.
 
I can load the data saved by command save -text file.txt x since it has the comment lines at beginning. But if I delete those commented line started with #, then octave will not load the data. 
 
Here is the text2.txt I tried to load:
 
linux-132w:/home/frank # od -c test2.txt
0000000   1   0   3  \n   1   0   4  \n   1   0   5  \n  \n
0000015
 
I am sorry for the confusion. As I stated, I am using octave 2.9.7 and I build it by myself. I do not use Cygwin at all.
 
I will try to download octave 2.9.8 and build it to see what will happen.
 
Thanks
 
Frank

 
On 8/24/06, John W. Eaton <address@hidden> wrote:
On 24-Aug-2006, frank wang wrote:

| This might be my setting problem. I am using a PC editor called Ultraedit to
| see the hex contents.

Does it show you all the bytes in the file, including the characters
used for line endings?  Do you see CRLF pairs at the ends of the lines
or just LF characters?

| The strange thing is when I type load -ascii test2.txt, I got
|
| octave:161> load -ascii test2.txt
| warning: the meaning of this option will change in a future
| warning: version of Octave to be compatible with Matlab.
| warning: To keep the meaning of your code the same across
| warning: this change, use the -text option instead.
| error: load: empty name keyword or no data found in file `test2.txt'

Yes, prior to 2.9.8, this will fail if you try to load a file that
contains numbers only and no header text (as is created by Octave's
save command with the -text option).  That's part of what the error
message is trying to tell you.  But in any case, as others have
already told you, you should not have to specify any options for
loading files since Octave will auto detect the file format.  However,
you may specify a file type option if you want to force Octave to
assume a particular file type, but then if the file type is incorrect,
Octave will not be able to load the file.

| if I type load test2.txt , octave will not generate any warning or error
| message. Both ways will not load the data into octave.

Does this work for you

x = hilb (3)
save -text file.dat x
clear x
x  ## should give an error about x being undefined
load file.dat
x  ## should show the saem value as originally generated by the call to hilb.

?

If this loads the file, then it should be possible for you to load a
file that you create in a text editor, though it is possible that some
CRLF vs LF only line ending is causing problems for you.

Since I think you already mentioned a filename like
c:\something\or\other, I'm assuming you are using Windows.  Is that
correct?

What version of Octave do you have?

Did you build Octave from sources yourself, or did you download a
binary distribution from somewhere?

If you downloaded a binary distribution, which one was it?

If you built it from source, then I assume you have Cygwin and all the
associated developer tools installed.  Is that correct?

If you have Cygwin, is the file you are trying to load on a text-mount
or binary-mount filesystem in the Cygwin directory hierarchy, or are
you trying to load a file from outside the Cygwin directory hierarcy
(i.e., /cygdrive/DEV/some/where)?

Does the file have CRLF or LF only line endings?  Send us the file and
the result of running

od -c

on the file so we can see precisely what the contents are on your
system.

Does loading a file work if you start Octave in a directory that is
inside the Cygwin directory hierarchy and that is mounted with the
binary mount type, and try to load a file that has LF only line
endings (this much at least should work)?

jwe


reply via email to

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