I have a rather cumbersome program that I ran as a script from the MATLAB command line. I decided to clean some nested functions a bit (I need to store everything in one file), but for this I also needed to make the program the function itself. As a result, the program no longer works in the base workspace, as was the case with the script. This means that I no longer have access to dozens of useful variables that remained after the program was launched, which is important for additional calculations and startup information.
Suggested workarounds that I can find - to use it assignin, evalinto define variables as global or set out in the definition of the current functionality of the program. However, none of these solutions appealed to me, and I really would like to find a way to make the workspace build on my own. Is there such a workaround? Or is there another way to do this that does not require me to manually define or label each specific variable that I want to get from a function?
source
share