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.