How to prevent a function from returning?

I have a script that executes a function that contains a gui. I'd like for the user to input some data, and when they hit a "close" button, that function returns a value. The problem is that the gui function, after loading all the uicontrols, returns automatically. How can I prevent the function from returning until the user hits a "close" button that contains "return." OR, is there a better way to approach the problem? Thanks.

 채택된 답변

Walter Roberson
Walter Roberson 2012년 9월 9일

1 개 추천

See waitfor() and uiwait(); also see the WindowStyle property of figures

댓글 수: 1

Justin
Justin 2012년 9월 9일
Thanks Walter. Using waitfor(h) at the very end of the function (where h is the main gui figure handle) worked perfectly. Do you know of any possible drawback of using this method? Furthermore, I did couple this with the 'modal' windowstyle for the figure which also seems to work well. Thanks again.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Graphics Objects에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by