exist

  • exist variable returns an integer describing what variable refers to; 0 means no name collision
  • exist('variable') is equivalent

Integer codes:

IntegerMeaning
0name does not exist or cannot be found
1name is a variable in the Workspace
2name is a file with extension .m, .mlx, or .mlapp, or file.ext exists in the folder
3name is a MEX-file on your MATLAB search path
4name is a Simulink model or library file on your MATLAB search path
5name is a built-in function
6name is a P-code file on your MATLAB search path
7name is a folder
8name is a class