open figure stored in workspace
105 views (last 30 days)
Show older comments
Rubén Pérez Sanz on 23 Jul 2020
Commented: Wesley on 12 Nov 2022
I am trying to open a figure that I have previously stored in the MATLAB Workspace. The figure has been stored in this way:
f1 = figure; figure(f1); plot(gr_RULE(10:end,1)); title('Rule for k');
However, when I try to open it the following error comes up:
Error using openFigure
The value of 'Filename' is invalid. It must satisfy the function: ischar.
Error in openfig>localGetFileAndOptions (line 104)
Error in openfig (line 37)
[filename, reuse, visibleAction] = localGetFileAndOptions(varargin);
I would appreciate if sb could let me know how to open them directly from the workspace and not from the directory file.
Jalaj Gambhir on 27 Jul 2020
This is because when you close the figure, the object handle is deleted. Read documentation link for more details. You can check this by executing isgraphics(f1) in the command window, which determines the validity of a graphic object handle.
Also refer to the answer here.
Hope this helps!
More Answers (0)
Find more on Specifying Target for Graphics Output in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!