|
Contents | Previous | Next | Subchapters |
| Syntax |
exist(id) |
exist(id, kind) | |
| See Also | path , exists , defined |
exist(id)
Determines the meaning of the identifier specified by id
in the current environment
where id is a string
.
The return value is a integer with the following meaning:
| Value | Meaning |
| 0 | has type novalue or is not defined and there is no corresponding automatic include file |
| 1 |
variable that does not have type novalue |
| 2 | is a defined function or corresponds to an automatic include file |
| 5 | intrinsic function |
novalue
This function is intended to provide as much compatibility with
the MATLAB® version as possible.
The type novalue
is a special case because
variables that are defined in O-Matrix, but not yet assigned a
value have this type in O-Matrix.
The MATLAB® version of exist returns zero for such variables.
exist(id, kind)
Returns true or false depending on if the identifier
specified by the string
id
is of the specified kind where kind is
equal to 'var', 'builtin', or 'file'.
temp.m is in the current directory
and contains the text
function y = temp(x)
y = exist('x');
If in Mlmode
you enter
clear
temp
O-Matrix will respond
0
On the other hand if you continue by entering
temp(1)
O-Matrix will respond
1
Note that the nargin
function
is the suggested way to determine if an argument is present in the call
to a function.