Skip to main content

NVAR_Exists

NVAR_Exists (name)

The NVAR_Exists function returns one if specified NVAR reference is valid or zero if not. It can be used only in user-defined functions.

For example, in a user function you can test if a global numeric variable exists like this:

NVAR /Z var1 = gVar1        // /Z prevents debugger from flagging bad NVAR
if (!NVAR_Exists(var1)) // No such global numeric variable?
Variable/G gVar1 = 0 // Create and initialize it
endif

will print 1 if MyGlobalVar is present in the current data folder.

See Also

WaveExists, SVAR_Exists, Accessing Global Variables and Waves