필터 지우기
필터 지우기

Loop in GUI to open and close the same GUI window

조회 수: 2 (최근 30일)
CHAZAUD Mathilde
CHAZAUD Mathilde 2019년 5월 15일
댓글: Adam 2019년 5월 15일
Hello everyone !
I have a GUI window that I want to close and reopen x-times. In this window I enter parameters and I have to enter them x-times (x defined by the user as an input in an other GUI window).
So, for example I have my window with an edit text box, and a pushbutton. Every time I click on the pushbutton, I want the window to close and re-open.
Once the window has been closed and opened x-times, it opens a different GUI window.
For now, here is my code:
for i = 1:(x- 1)
close
actualwindow
i=i+1;
end
if (i == (x))
close
nextwindow
end
But it doesn't work. the loop increases 'i', but it didn't open the window at each increase, it opens it just one time, quickly close it, and goes directly to nextwindow.
What is the problem ?
Thanks for your help !
  댓글 수: 2
Rik
Rik 2019년 5월 15일
You're probably forgetting a uiwait call in there.
It is also probably a good idea to modify the CloseReqFcn of your secondary GUI to get the values out before the GUI actually closes (don't forget to put delete(gcbo) in that function).
Adam
Adam 2019년 5월 15일
It would seem a lot simpler and less unpleasant in terms of figures keep opening and closing to just reset the GUI when you click the push button, up until the last time when it would then finally close it.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by