Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Close GUI without Error under Continuous Data Acquisition

Subject: Close GUI without Error under Continuous Data Acquisition

From: Christopher Kube

Date: 10 Dec, 2010 17:53:05

Message: 1 of 2

Hi, I have GUI built that connects with a serial object. The GUI executes a continuous read of the serial object via a while loop. I would like to be able to use the close button (red x) to close the GUI while the while loop is active without an error.

Currently, if I try to close I get the following error:

??? Operation terminated by user during ==> kube2>disp_temp at 105

In ==> kube2 at 76
disp_temp(i)

Subject: Close GUI without Error under Continuous Data Acquisition

From: Sean de

Date: 10 Dec, 2010 18:22:05

Message: 2 of 2

"Christopher Kube" <ckube@charter.net> wrote in message <idtpe1$kpf$1@fred.mathworks.com>...
> Hi, I have GUI built that connects with a serial object. The GUI executes a continuous read of the serial object via a while loop. I would like to be able to use the close button (red x) to close the GUI while the while loop is active without an error.
>
> Currently, if I try to close I get the following error:
>
> ??? Operation terminated by user during ==> kube2>disp_temp at 105
>
> In ==> kube2 at 76
> disp_temp(i)


Three ideas. They're in ascending order for better options (in my opinion)
-You could use the status of the GUI figure as your conditional in the while loop so that when the figure no longer exists it stops.
-You could use a flag as your while loop conditional. Have it stored in appdata (getappdata/setappdata) and in the CloseRequestFcn for your GUI, set it to false.
-Instead of using a while loop use a timer object. Then stop the timer directly.
doc timer

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us