Skip to content

Commit 9505caa

Browse files
authored
Merge pull request #137 from Remi-Gau/remi-doc
update doc on saveEvents
2 parents 7257021 + 2535ac6 commit 9505caa

File tree

3 files changed

+46
-39
lines changed

3 files changed

+46
-39
lines changed

src/createDataDictionary.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ function createDataDictionary(cfg, logFile)
1414
% :param logFile: Contains the data you want to save.
1515
% :type logFile: structure
1616

17-
1817
fileName = strrep(logFile(1).filename, '.tsv', '.json');
1918
fullFilename = getFullFilename(fileName, cfg);
2019

src/saveEventsFile.m

Lines changed: 44 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,74 @@
11
% (C) Copyright 2020 CPP_BIDS developers
22

3-
function [logFile] = saveEventsFile(action, cfg, logFile)
3+
function logFile = saveEventsFile(action, cfg, logFile)
44
%
55
% Function to save output files for events that will be BIDS compliant.
66
%
77
% USAGE::
88
%
99
% [logFile] = saveEventsFile(action, cfg, logFile)
1010
%
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
1623
%
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.
2425
%
25-
% example::
26+
% Example::
2627
%
2728
% logFile(1,1).onset = 2;
2829
% logFile(1,1).trial_type = 'motion_up';
2930
% logFile(1,1).duration = 1;
30-
% logFile(1,1).speed = 2;
31-
% logFile(1,1).is_fixation = true;
3231
%
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:
3733
%
34+
% .. todo:
35+
% wait for updates on the API of this function to finish updating
3836
%
39-
% action:
37+
% Example::
4038
%
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)
4643
%
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.
4849
%
49-
% logFile = saveEventsFile('open', cfg, [], 'direction', 'speed', 'target');
50+
% Example::
5051
%
52+
% logFile = saveEventsFile('open', cfg, logFile);
5153
%
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:
5456
%
55-
% - logFile.onset
56-
% - logFile.trial_type
57-
% - logFile.duration
57+
% - logFile.onset
58+
% - logFile.trial_type
59+
% - logFile.duration
5860
%
59-
% The name of any extra column whose content must be saved should be listed in varargin.
61+
% Example::
6062
%
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)
6371
%
64-
% See ``tests/test_saveEventsFile()`` for more details on how to use it.
6572
%
6673

6774
if nargin < 1

src/utils/createValidName.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
%
99
% [taskName, taskNameValid] = createTaskName(taskName)
1010
%
11-
% :param taskName: Name given to the task. Can be any string including spaces and special characters.
11+
% :param taskName: Name given to the task. Can be any string including spaces
12+
% and special characters.
1213
% :type taskName: string
1314
%
1415
% :returns:

0 commit comments

Comments
 (0)