-
Notifications
You must be signed in to change notification settings - Fork 0
Program Structure
Michelle Sands edited this page Nov 11, 2025
·
7 revisions
StimControl is a programmatically generated MATLAB app. It uses handle structs and similar data types to manage its connected features:
- GUI features are managed in
h - connected devices are managed in
d - save paths are managed in
path - general protocol parameters are managed in
g - trial-specific stimulation parameters are managed in
p - the timer that manages experiment execution logic is stored in
t - state machine flags are handled in
f
In the Session tab, state logic is handled jointly by a timer, t, the dependent variable status, and the flags struct f. When the program is in different states, different buttons are made available. See the figure below for a full overview of the state machine logic.

-
stopTrial- set to true when the STOP button is pressed -
startTrial- set to true when the START or START SINGLE TRIAL buttons are pressed, or after the inter-trial interval during an experiment -
passive- set to true when the START PASSIVE button is pressed -
pause- set to true when the PAUSE button is pressed -
resume- set to true when the RESUME button is pressed -
runningExperiment- set to true when START button is pressed -
trialLoaded- set to true when a trial has been loaded, used to track individual trial loading over an experiment -
trialFinished-
| Status Name | Meaning | Lamp Colour | Start | Stop | Pause | Resume | StartPassive | SingleTrial |
|---|---|---|---|---|---|---|---|---|
| Not Initialised | devices not ready | dark grey | n | n | n | n | y | n |
| No protocol loaded | Meaning | LampColour | Start | Stop | Pause | Resume | StartPassive | SingleTrial |
| Ready | Trial loaded | green | y | n | n | n | y | y |
| Running | Actively stimulating / acquiring | orange | n | y | n | n | n | n |
| Inter-trial | running an experiment, in the inter-trial interval | white | n | y | y | n | n | n |
| Paused | inter-trial, with the inter-trial countdown paused | teal | n | y | n | y | n | n |
| Stopping | Stopping a trial and flushing data | red | n | n | n | n | n | n |
| Awaiting Trigger | in passive mode, will enter 'running' when external trigger is received | teal | n | y | n | n | n | n |
| Error | Something has gone wrong | red | - | - | - | - | - | - |