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