A figure drawn in a function disappears after exiting the function.

조회 수: 10 (최근 30일)
Ranjan Sonalkar
Ranjan Sonalkar 2015년 1월 13일
댓글: Image Analyst 2015년 1월 13일
I call a function multiple times with a different integer argument, 'month'. I open up a new figure each time within the function - 'figure(month)'. However, the figures do not survive when the program ends. I have tried calling the function with a new figurehandle and opened the figure within the function with that figurehandle. But, the figure still does not survive. Even if I call the function once, the figure does not survive. How can I draw a figure within a function and have it available when the program ends>
In the calling program, I have "figureHandle=figure(month)". I pass the figureHandle as an argument to the function and within the function I initiate the figure by "figure(figureHandle)". What am I doing wrong?

답변 (1개)

Image Analyst
Image Analyst 2015년 1월 13일
Are you assigning the figure() output to a handle, which will be a local variable? When the function exits, that local variable will get destroyed/deleted and so your figure window will probably go away also.
  댓글 수: 2
Ranjan Sonalkar
Ranjan Sonalkar 2015년 1월 13일
Please see further explanation I added to the question.
Image Analyst
Image Analyst 2015년 1월 13일
That explanation does not explain what's going wrong. We're going to need your code. Strip it down to the essentials and attach it.

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

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by