[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with exist
From: |
Andy Adler |
Subject: |
Problem with exist |
Date: |
Sat, 22 Feb 2003 11:02:47 -0500 (EST) |
I'm having a problem with exist().
If foo.m is currently loaded then
exist('foo.anything') is true, regardless
of whether the file exists.
This is a problem, because my code does
function out=foo();
if exist('foo.mat');
load('foo.mat');
else
out=calculate_out();
save('foo.mat',out);
end
This example shows the problem
$ cat > foo.m
function x=foo(y); x=y+1; endfunction;
$ octave -q
octave:1> exist('foo')
ans = 2
octave:2> exist('foo.mat')
ans = 0
octave:3> foo(1);
octave:4> exist('foo')
ans = 2
octave:5> exist('foo.mat')
ans = 2
octave:6> exist('foo.anything')
ans = 2
Andy
- Problem with exist,
Andy Adler <=