BpodParameterGUI
BpodParameterGUI()
Description
Displays the settings from the "GUI" subfield of a settings struct in a user interface for viewing and manual override.
The GUI subfield names (i.e. X in Settings.GUI.X) are displayed on the left. Edit boxes populated with parameter values for each X are shown on the right.
In the current version, only numerical parameters are valid, and only text edit boxes are used to show parameters.
When synced, the GUI will display any changes to the parameter values since the last sync.
If the user manually edited a parameter, this becomes the new value irrespective of changes the machine made to the parameter in the intervening time.
An example GUI automatically generated from this struct:
Settings.SamplingRate = 44100
Settings.GUI.SineWaveFrequency = 500;
Settings.GUI.SpeakerType = 1;
is shown here:
Syntax
On first call:
BpodParameterGUI('init', Settings)
On subsequent calls:
NewSettings = BpodParameterGUI('sync', Settings)
Parameters
Settings: A struct of settings and parameters with at least some numeric parameters in the subfield "GUI"
Returns
NewSettings: The settings struct, updated with any parameter changes manually entered by the user
Example
% 1. This code initializes a Bpod settings struct selected on protocol launch, and syncs it on each of 10 trials.
% Import settings or populate if empty
S = BpodSystem.ProtocolSettings; % Load settings chosen in launch manager into current workspace as a struct called S
if isempty(fieldnames(S)) % If settings file was an empty struct, populate struct with default settings
S.GUI.SoundDuration = 0.5; % Duration of sound (s)
S.GUI.TimeoutDuration = 2; % Duration of timeout for punishment (s)
end
% Initialize parameter GUI plugin
BpodParameterGUI('init', S);
% Run 10 trials:
for currentTrial = 1:10
S = BpodParameterGUI('sync', S); % Sync parameters with BpodParameterGUI plugin
...Create, send and run state matrix, add and save events, update S with new parameters based on performance
end