|
1 | 1 | function outputFiltered = readOutputFilter(cfg, filterHeader, filterContent) |
2 | 2 | % outputFiltered = readOutputFilter(cfg, filterHeader, filterContent) |
3 | | - % |
4 | | - % It will display in the command window the content of the `output.tsv' filtered by one element |
5 | | - % of a target column. At the moment it works only for string content and can retrieve the tsv |
| 3 | + % |
| 4 | + % It will display in the command window the content of the `output.tsv' filtered by one element |
| 5 | + % of a target column. At the moment it works only for string content and can retrieve the tsv |
6 | 6 | % path form `cfg`. |
7 | | - % |
| 7 | + % |
8 | 8 | % DEPENDENCIES: |
9 | 9 | % - bids_matlab (from CPP_BIDS) |
10 | | - % |
| 10 | + % |
11 | 11 | % INPUT: |
12 | | - % |
| 12 | + % |
13 | 13 | % - cfg: the main experiment structure |
14 | | - % - filterHeader: string, the column header where the ctarget content is stored (e.g., for |
| 14 | + % - filterHeader: string, the column header where the ctarget content is stored (e.g., for |
15 | 15 | % 'condition name' will be 'trial type') |
16 | 16 | % - filterContent: string, the content of the column you want to filter out. It can take just |
17 | | - % part of the content name (e.g., you want to display the triggers and you have 'trigger_motion' |
18 | | - % and 'trigger_static', 'trigger' as input will do) |
| 17 | + % part of the content name (e.g., you want to display the triggers and you have |
| 18 | + % 'trigger_motion' and 'trigger_static', 'trigger' as input will do) |
19 | 19 | % |
20 | 20 | % OUTPUT: |
21 | 21 | % |
22 | 22 | % - outputFiltered: dataset with only the specified content, to see it in the command window |
23 | 23 | % use display(outputFiltered) |
24 | | - |
| 24 | + |
25 | 25 |
|
26 | 26 | % Get the outputfile path |
27 | 27 | tsvFile = fullfile(cfg.dir.outputSubject, ... |
28 | 28 | cfg.fileName.modality, ... |
29 | 29 | cfg.fileName.events); |
30 | | - |
| 30 | + |
31 | 31 | % Read the the tsv file and store each column in a field of `output` structure |
32 | 32 | output = bids.util.tsvread(tsvFile); |
33 | 33 |
|
|
36 | 36 |
|
37 | 37 | % Convert the structure to dataset |
38 | 38 | outputDataset = struct2dataset(output); |
39 | | - |
| 39 | + |
40 | 40 | % Get the dataset with the content of intereset |
41 | | - outputFiltered = outputDataset(filterIdx,:); |
| 41 | + outputFiltered = outputDataset(filterIdx, :); |
42 | 42 |
|
43 | 43 | end |
0 commit comments