@@ -23,7 +23,6 @@ Here are the naming templates used.
2323
2424` sub-<participant_label>[_ses-<label>][_acq-<label>]_task-<task_label>_eyetrack.<manufacturer_specific_extension> `
2525
26-
2726## Contributing
2827
2928Feel free to open issues to report a bug and ask for improvements.
@@ -103,6 +102,68 @@ Function to save output files for events that will be BIDS compliant.
103102### checkCFG
104103Check that we have all the fields that we need in the experiment parameters.
105104
105+
106+ ## Usage
107+
108+ ``` matlab
109+
110+ % define the folder where the data will be saved
111+ expParameters.outputDir = fullfile(pwd, '..', 'output');
112+
113+ % define the name of the task
114+ expParameters.task = 'testtask';
115+
116+ % can use the userInputs function to collect subject info
117+ % expParameters = userInputs;
118+
119+ % or declare it directly
120+ expParameters.subjectGrp = '';
121+ expParameters.subjectNb = 1;
122+ expParameters.sessionNb = 1;
123+ expParameters.runNb = 1;
124+
125+ % Use the verbose switch to know where your data is being saved
126+ expParameters.verbose = true;
127+
128+ % In case you are using en eyetracker
129+ cfg.eyeTracker = false;
130+
131+ % if the device is set to 'PC' then the data will be saved in the `beh` folder
132+ cfg.device = 'PC';
133+
134+ % if the device is set to 'scanner' then the data will be saved in the `func` folder
135+ % cfg.device = 'scanner';
136+
137+ % check that cfg and exparameters have all the necessary information and fill in any missing field
138+ expParameters = checkCFG(cfg, expParameters);
139+
140+ % create the filenames
141+ expParameters = createFilename(cfg, expParameters);
142+
143+ % initialize the events files with the typical BIDS columns (onsets, duration, trial_type)
144+ % and add some more in this case (Speed and is_Fixation)
145+ logFile = saveEventsFile('open', expParameters, [], 'Speed', 'is_Fixation');
146+
147+ % create the information about 2 events that we want to save
148+ logFile(1,1).onset = 2;
149+ logFile(1,1).trial_type = 'motion_up';
150+ logFile(1,1).duration = 1;
151+ logFile(1,1).speed = 2;
152+ logFile(1,1).is_fixation = true;
153+
154+ logFile(2,1).onset = 3;
155+ logFile(2,1).trial_type = 'static';
156+ logFile(2,1).duration = 4;
157+ logFile(2,1).is_fixation = 3;
158+
159+ % add those 2 events to the events.tsv file
160+ saveEventsFile('save', expParameters, logFile, 'speed', 'is_fixation');
161+
162+ % close the file
163+ saveEventsFile('close', expParameters, logFile);
164+
165+ ```
166+
106167## Contributors ✨
107168
108169Thanks goes to these wonderful people ([ emoji key] ( https://allcontributors.org/docs/en/emoji-key ) ):
0 commit comments