|
1 | 1 | % (C) Copyright 2020 CPP_BIDS developers |
2 | 2 |
|
3 | 3 | function [logFile] = saveEventsFile(action, cfg, logFile) |
4 | | - % [logFile] = saveEventsFile(action, cfg, logFile) |
5 | | - % |
| 4 | + % |
6 | 5 | % Function to save output files for events that will be BIDS compliant. |
7 | 6 | % |
8 | | - % USAGE |
| 7 | + % USAGE:: |
| 8 | + % |
| 9 | + % [logFile] = saveEventsFile(action, cfg, logFile) |
9 | 10 | % |
10 | | - % [logFile] = saveEventsFile('init', [cfg], logFile) |
11 | | - % [logFile] = saveEventsFile('open', [cfg], logFile) |
12 | | - % [logFile] = saveEventsFile('open_stim', [cfg], logFile) |
13 | | - % [logFile] = saveEventsFile('save', [cfg], logFile) |
14 | | - % [logFile] = saveEventsFile('close', cfg, logFile) |
| 11 | + % logFile] = saveEventsFile('init', [cfg], logFile) |
| 12 | + % logFile] = saveEventsFile('open', [cfg], logFile) |
| 13 | + % logFile] = saveEventsFile('open_stim', [cfg], logFile) |
| 14 | + % logFile] = saveEventsFile('save', [cfg], logFile) |
| 15 | + % logFile] = saveEventsFile('close', cfg, logFile) |
15 | 16 | % |
16 | 17 | % INPUTS |
17 | 18 | % |
18 | 19 | % logFile: |
19 | | - % When you want to save your data logFile contains the data you want to save. |
20 | | - % The logFile variable that contains the n events you want to % save must be a nx1 structure. |
| 20 | + % |
| 21 | + % When you want to save your data ``logFile`` contains the data you want to save. |
| 22 | + % The ``logFile`` variable that contains the n events you want to save must be a nx1 structure. |
21 | 23 | % Each field will be saved in a separate column. |
22 | 24 | % |
23 | | - % example: |
24 | | - % logFile(1,1).onset = 2; |
25 | | - % logFile(1,1).trial_type = 'motion_up'; |
26 | | - % logFile(1,1).duration = 1; |
27 | | - % logFile(1,1).speed = 2; |
28 | | - % logFile(1,1).is_fixation = true; |
| 25 | + % example:: |
29 | 26 | % |
30 | | - % logFile(2,1).onset = 3; |
31 | | - % logFile(2,1).trial_type = 'static'; |
32 | | - % logFile(2,1).duration = 4; |
33 | | - % logFile(2,1).is_fixation = 3; |
| 27 | + % logFile(1,1).onset = 2; |
| 28 | + % logFile(1,1).trial_type = 'motion_up'; |
| 29 | + % logFile(1,1).duration = 1; |
| 30 | + % logFile(1,1).speed = 2; |
| 31 | + % logFile(1,1).is_fixation = true; |
| 32 | + % |
| 33 | + % logFile(2,1).onset = 3; |
| 34 | + % logFile(2,1).trial_type = 'static'; |
| 35 | + % logFile(2,1).duration = 4; |
| 36 | + % logFile(2,1).is_fixation = 3; |
34 | 37 | % |
35 | 38 | % |
36 | 39 | % action: |
37 | | - % - 'open': will create the file ID and return it in logFile.fileID using the information in |
38 | | - % the expParameters structure. This file ID is then reused when calling that function |
39 | | - % to save data into this file. |
40 | | - % This creates the header with the obligatory 'onset', 'trial_type', 'duration' required |
41 | | - % by BIDS and other columns can be specified in varargin. |
42 | 40 | % |
43 | | - % example : logFile = saveEventsFile('open', cfg, [], 'direction', 'speed', 'target'); |
| 41 | + % - ``'open'`` will create the file ID and return it in ``logFile.fileID`` using the information in |
| 42 | + % the ``cfg`` structure. This file ID is then reused when calling that function |
| 43 | + % to save data into this file. |
| 44 | + % This creates the header with the obligatory ``'onset'``, ``'duration'`` required |
| 45 | + % by BIDS and other columns can be specified in varargin. |
| 46 | + % |
| 47 | + % example:: |
| 48 | + % |
| 49 | + % logFile = saveEventsFile('open', cfg, [], 'direction', 'speed', 'target'); |
| 50 | + % |
| 51 | + % |
| 52 | + % - ``'save'`` will save the data contained in logfile by using the file ID ``logFile.fileID``; |
| 53 | + % logfile must then contain: |
| 54 | + % |
| 55 | + % - logFile.onset |
| 56 | + % - logFile.trial_type |
| 57 | + % - logFile.duration |
44 | 58 | % |
45 | | - % - 'save': will save the data contained in logfile by using the file ID logFile.fileID; |
46 | | - % logfile must then contain: |
47 | | - % - logFile.onset |
48 | | - % - logFile.trial_type |
49 | | - % - logFile.duration |
50 | 59 | % The name of any extra column whose content must be saved should be listed in varargin. |
51 | 60 | % |
52 | | - % - 'close': closes the file with file ID logFile.fileID. If expParameters.verbose is set |
53 | | - % to true then this will tell you where the file is located. |
| 61 | + % - ``'close'`` closes the file with file ID ``logFile.fileID``. If ``cfg.verbose`` is set |
| 62 | + % to true then this will tell you where the file is located. |
| 63 | + % |
| 64 | + % See ``tests/test_saveEventsFile()`` for more details on how to use it. |
54 | 65 | % |
55 | | - % See test_saveEventsFile in the test folder for more details on how to use it. |
56 | 66 |
|
57 | 67 | if nargin < 1 |
58 | 68 | error('Missing action input'); |
|
0 commit comments