ISSET Test If Variable Set

Section: Inspection Functions

Usage

Tests for the existence and non-emptiness of a variable. the general syntax for its use is
   y = isset('name')

where name is the name of the variable to test. This is functionally equivalent to

   y = exist('name','var') & ~isempty(name)

It returns a logical 1 if the variable is defined in the current workspace, and is not empty, and returns a 0 otherwise.

Example

Some simple examples of using isset
--> who
  Variable Name      Type   Flags             Size
              a    double                    [23 12 5]
            ans    uint32                    [1 1]
              c     int32                    [1 3]
              f    string                    [1 5]
              p    double                    [1 256]
              x      cell                    [2 1]
              y    struct                    [1 1]
--> isset('a')
ans = 
  <logical>  - size: [1 1]
 1  
--> a = [];
--> isset('a')
ans = 
  <logical>  - size: [1 1]
 0  
--> a = 2;
--> isset('a')
ans = 
  <logical>  - size: [1 1]
 1