From bug-octave-request at bevo dot che dot wisc dot edu Thu Jun 7 15:28:43 2001 Subject: problem with exist(fn)==2 and load(fn); From: "John W. Eaton" To: a dot schloegl at ieee dot org Cc: bug-octave at bevo dot che dot wisc dot edu Date: Thu, 7 Jun 2001 15:28:33 -0500 On 10-May-2001, Alois =?iso-8859-1?Q?Schl=F6gl?= wrote: | t.mat is a file within LOADPATH but not within the current directory. | I get the following result | | fn='t.mat'; | octave:63> exist(fn) | ans = 2 | octave:64> load t.mat | error: load: couldn't open input file `t.mat' | error: evaluating index expression near line 64, column 1 | | Therefore EXIST cannot be used to check the existance of the file fn; | and the following statement does not work. | if exist(fn)==2, load(fn); end; | | IMO, if exist(fn) finds the file, also load should be able to find it. | | Sorry, I've no fix for this problem. The fix would be to make Octave's load command (optionally) look in the LOADPATH for files to load. Would someone like to implement that and contribute a patch? To get the behavior you want, use something like load (file_in_loadpath ("t.mat")); Thanks, jwe ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------