open figure stored in workspace

조회 수: 81 (최근 30일)
Rubén Pérez Sanz
Rubén Pérez Sanz 2020년 7월 23일
댓글: Strider 2022년 11월 12일
Hi there,
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:
>> openfig(f1)
Error using openFigure
The value of 'Filename' is invalid. It must satisfy the function: ischar.
Error in openfig>localGetFileAndOptions (line 104)
ip.parse(args{:});
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.
KR
  댓글 수: 2
Julio Vela
Julio Vela 2021년 12월 15일
the answer is: figure(Name_figure). Example: figure(figure(1))
Strider
Strider 2022년 11월 12일
Thanks Julio!

댓글을 달려면 로그인하십시오.

채택된 답변

Jalaj Gambhir
Jalaj Gambhir 2020년 7월 27일
Hi,
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!
  댓글 수: 1
Rubén Pérez Sanz
Rubén Pérez Sanz 2020년 8월 4일
Many thanks!!! it worked!!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by