help-octave
[Top][All Lists]
Advanced

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

Re: How to get Octave.app to work?


From: Vic Norton
Subject: Re: How to get Octave.app to work?
Date: Mon, 3 Sep 2007 21:59:51 -0400

You are right, Matthias. I should have closed the file. Unfortunately this makes no difference. I expect the file was closed when each octave shell was closed.

Here's a new attempt, printing out the error messages. I've also reversed Test 1 and Test 2. Test 1 is the octave-2.9.9 attempt. This is where I am having the mysterious problem.

Test 1. From terminal I execute
   vic$ /usr/local/bin/octave
This gets me into octave-2.9.9. Now I execute
   octave> [fid, msg] = fopen ("~/octave/tmp/test.txt", "wt");
   octave> printf("%d: %s\n", fid, msg);
   -1: No such file or directory
   octave> fclose(fid);
   error: fclose: invalid stream number = -1
   octave> quit
As far as I can tell, octave-2.9.9 can simply not see the file
~/octave/tmp/test.txt (which does exist, though it needn't.).

Test 2. From terminal I execute
   vic$ /Applications/Octave.app/Contents/Resources/bin/octave
This gets me into octave-2.9.13. Now I execute
   octave-2.9.13> [fid, msg] = fopen ("~/octave/tmp/test.txt", "wt");
   octave-2.9.13> printf("%d: %s\n", fid, msg);
   3:
   octave-2.9.13> fclose(fid);
   octave-2.9.13> quit
Apparently octave-2.9.13 has no trouble seeing the file
~/octave/tmp/test.txt.

This is a mystery to me. I really can't think of a simpler experiment, but I would be open to any suggestions. My primary goal is to be able to call the octave-2.9.13 in Octave.app from within a perl script. I am definitely nowhere near that. I can't even figure out what is going wrong with octave-2.9.9.


Regards,

Vic


On Sep 3, 2007, at 4:46 PM, Matthias Brennwald wrote:


On 03.09.2007, at 21:39, Vic Norton wrote:


On Sep 3, 2007, at 1:34 PM, Matthias Brennwald wrote:

Test 1. From terminal I execute
    vic$ /Applications/Octave.app/Contents/Resources/bin/octave
This gets me into octave-2.9.13. Now I execute
    octave-2.9.13> printf("%d\n", fopen ("~/desktop/
octave_output.txt", "wt"));
The output is
    3

You've just opened the file with write access...

That's what I want to do, write to it.

Test 2. From terminal I execute
    vic$ /usr/local/bin/octave
This gets me into octave-2.9.9. Now I execute
    octave> printf("%d\n", fopen ("~/desktop/octave_output.txt",
"wt"));
The output is
    -1

...and you're trying to open the same file with write access again. I
guess that might explain why this second call to fopen is not
successful. Not sure, though.

This is a different shell and a different version of octave, Matthias.

I know. But its the same file, and this file is in use with write
access by the first Octave (2.9.13). I guess its not a good idea to
open the same file twice with write access (but not sure). What would
happen if both Octaves would write to the file?

The -1 output tells me that I can't write to the octave_output.txt
file on my desktop because this octave (2.9.9) can't see it.

What do you mean by "can't see it"? The -1 simply means there has
been an error with opening the file.

What happens if you try to open the file with read access only?

Also, from reading 'help fopen', you will see that you can get an
error message back from fopen. Try...

[fid,msg] = fopen("~/desktop/octave_output.txt","wt")

...and check msg for a description of the error that occurs with
opening your file in Octave 2.9.9.

Matthias



reply via email to

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