MATLAB: Static workspace assignment.

MATLABworkspce

Hi,
I'm getting following error when i run a 'calibration file' inside a function called "RSI_file". The "init_file" contains values of various variables, i need to create a table with min/max values of each variable and the calibration values taken from this file. I've succeeded in obtaining the min/max values, but running this file inside a function is giving error. Can someone please help me out?
ERROR –
Attempt to add "<var_name>" to a static workspace. See MATLAB Programming, Restrictions on Assigning to Variables for details.
Error in ==> RSI_file at 217 run(init_file);

Best Answer

If you must do that, then remove the final 'end' statement from the RSI_file function. This would require removing the final 'end' statement from all other functions in the same file, and would also disallow you from using nested functions.
Alternately, leave all the 'end' statements the way they are, but initialize all those variables (to anything) before the run() call so that they have slots in the static workspace.