[Top][All Lists]

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

Re: How to tell a function from a string

From: Jim Van Zandt
Subject: Re: How to tell a function from a string
Date: Tue, 20 Jan 1998 13:52:54 -0500

In message <address@hidden>, "John W. Eaton
" writes:
>On 20-Jan-1998, Jim Van Zandt <address@hidden> 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

reply via email to

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