MATLAB: How to run a script from a GUI that will run in the ‘base’ workspace

MATLABmatlab guisimulinkworkspace

I have a simulink model that uses a lot of variables from the base workspace. Now I am making a GUI that runs the model, but I want to be able to reinitialize the base workspace by calling the script that does this. But I want to do it from the GUI. How do I run a script as if in the base workspace so that it populates all the variables there? I could use assignin('base', var, reinitvar), but this would be extremely tedious for all the variables. Is there another option?

Best Answer

evalin('base', 'name_of_script')