Why do I get stuck on workspacefunc.m?

5 views (last 30 days)
Mitchell Tillman
Mitchell Tillman on 21 Nov 2021
Answered: Pranjal Kaura on 24 Nov 2021
Ever since I have started using appdesigner, I have a frequently reoccurring issue with a built in Matlab function called 'workspacefunc.m'. I always get stuck on line 310 of this function, which is: (Matlab's comments included)
% try to eval the variable here, instead of when calling
% the function, so that we can catch any errors and prevent
% error beeping
v = evalin('caller', varargin{1});
When I get stuck on this function, oftentimes there is no way for me to quit debugging and rerun my code. I have to resort to exiting Matlab, which is a huge pain. Sometimes after clicking on it dozens of times in a row very fast, I can get the error to go away without restarting.
Matlab does not provide me with an error code. Also, as far as I can tell this error is not due to a syntax or logic error. It happens when debugging, after setting a breakpoint.
Is there something I'm missing here? Why is this happening?

Answers (1)

Pranjal Kaura
Pranjal Kaura on 24 Nov 2021
Hey Mitchel,
Thank you for bringing this up. I have heard that this issue is known and the corresponding parties may be investigating further.
A possible cause of this issue is:
Entering the command
>> path(<new directory>)
instead of
>> addpath(<new directory>).
This command changes the search path to its argument, which should be a string of folders. Herein specifying only one folder, renders MATLAB installation unusable, since MATLAB cannot find any of the important .m files it needs to execute while processing any commands entered - workspacefunc.m being one of them.
Exiting and restarting MATLAB should resolve this issue, since the default MATLAB path is restored if "savepath" is not called.
In the future, instead of the "path" command, please use the "addpath" command. This simply adds an extra folder to the pre-existing path instead of overwriting the entire MATLAB path
Hope this helps!

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!