From bug-octave-request at bevo dot che dot wisc dot edu Fri Sep 15 20:40:59 1995 Subject: exist() returns wrong value under some circumstances From: John Eaton To: torsten at kom dot auc dot dk (torsten martinsen) Cc: bug-octave at che dot utexas dot edu Date: Fri, 15 Sep 1995 20:40:26 -0500 torsten martinsen wrote: : Description: : ----------- : : If a file named FOO (eg. produced by `save') is present in : the current directory, then exist("FOO") will return 2, : signifying that FOO is a function. This is of course only : correct if the FOO file contains a function definition. This appears to be compatible with Matlab 4.x: < M A T L A B (R) > (c) Copyright 1984-94 The MathWorks, Inc. All Rights Reserved Version 4.2c Nov 28 1994 >> help exist EXIST Check if variables or functions exist. EXIST('A') returns: 0 if A does not exist 1 if A is a variable in the workspace 2 if A is an M-file on MATLAB's search path 3 if A is a MEX-file on MATLAB's search path 4 if A is a compiled SIMULINK function 5 if A is a built-in MATLAB function Note: EXIST('A') also returns 2 if a file named just 'A' is on MATLAB's search path. Also, I've just added the return codes 3 (actually for .oct files instead of .mex files) and 5. Thanks, jwe