When writing a script that loads data, it's a waste of time to wait for it to load each time.
How to check to see if the variable is defined?
You can use the exist
function in Octave to do the work. It can be used to check the existence of given name as a variable, built in function, file, or directory. In you case, to check the existence of a variable, you may use something like this:
if (exist("your_var_name", "var") == 1)
printf("varname exists");
else
printf("varname not exists");
endif
You may refer the following links for detailed information:
Need to put the variable name in quotes too,
exist("varname", "var")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With