From: Kate J. on
I’m setting up a system that includes a gui created using GUIDE. In each “episode” of the planned event, a human user will view an animation and give feedback via a mouse; my system, along with the user’s input, will control the animation, and if a target state is achieved, the episode will be considered finished. However, if 10 seconds of the episode pass and the target still hasn’t been reached, the episode needs to be automatically terminated, and the next episode started. So, there are 2 conditions, success or 10 sec elapsed, that will end each episode.

The user will initially click a Start button on the gui to begin the whole series of episodes, but *won’t* be clicking any reset button to start each individual episode; the whole series needs to be controlled by my m-file.

Could anyone recommend the best way to program these episodes in my gui’s m-file? I am more familiar with the C language, and am not sure how to do this best using GUIDE and Matlab code. As far as I know, my options include:

-- using a timer function to encapsulate each episode; timer will end early if success is achieved (using which command?)
-- using a while loop (if all of the ‘functions’ in my m-file are gui-related callbacks, in which callback should this loop be located?)
-- other suggestions about tools/structures that I’m not aware of?

Thanks in advance for your input!