From help-octave-request at bevo dot che dot wisc dot edu Tue Jan 20 12:52:59 1998 Subject: Re: How to tell a function from a string From: Jim Van Zandt To: "John W. Eaton" cc: help-octave at bevo dot che dot wisc dot edu Date: Tue, 20 Jan 1998 13:52:54 -0500 In message <199801201806 dot MAA00735 at tillamook-sharp dot bogus dot domain>, "John W. Eaton " writes: >On 20-Jan-1998, Jim Van Zandt wrote: >| What's wrong with the above test? > >Uh, I just completely forgot about it. After six months, even the author needs the documentation. >| I...decided that "exist(NAME) > 1" was a reasonable test. (Can it >| ever return 4?) > >No, Octave's exist function doesn't currently return 4, but I'm not >sure what Matlab uses that return code for, so if you want to write >portable code, you might want to check that first. Here are the MATLAB return codes: 0 undefined 1 variable 2 M-file or a file of unknown type 3 MEX-file 4 MDL-file 5 built-in MATLAB function 6 P-file 7 directory I guess the acceptable codes are 2-6. (I don't know what MDL-files and P-files are.) The test would fail for "a file of unknown type". - Jim Van Zandt