How do I get my command window to load a workspace previously saved?

I have saved the workspace but can't get it to reopen when I log back into Matlab. The code won't load up.

7 Comments

You do not show any error message, and you do not show what is in the workspace before and after. What you did show would be consistent with the load() having succeeded.
Thank you for the response, but why is the code still not showing?
I can't show the workspace before because that is what I am having trouble to load.
If you look at the variables stored in that MAT-file and what is in the workspace after the load call executes, you should see those variables in the workspace.
What's in the MAT-file:
whos('-file', 'Matlab Refresher Plotting Vectors.mat')
What's in the workspace:
whos
What specifically did you expect the state of MATLAB to be after you loaded that MAT-file? What variables do you expect to exist that don't? Do you expect MATLAB to resume running your code? Do you expect figure windows to be open?
In the case of graphics objects:
If you load() a graphics object, then it will not be displayed if the Visible property for it in the file was set off.
People sometimes set the visibility of a figure to off, and save the figure, and then when they load the mat file nothing shows up... because the figure now exists but is not visible.
Hi I'm having the same problem, I am wondering if you figured out a way to display the command window for saved matlabs.
save() does not store the contents of the command window. If I recall correctly it is possible to query what is in the command window buffer and save that as a variable, but I am not sure there is a way to insert it back into the command window after loading.
Perhaps you might prefer to use Live Script.

Sign in to comment.

Answers (0)

Asked:

on 6 Jan 2021

Commented:

on 2 Oct 2021

Community Treasure Hunt

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

Start Hunting!