11function outputFiltered = readOutputFilter(filterHeader , filterContent , varargin )
2- % outputFiltered = readOutputFilter(cfg, filterHeader, filterContent)
2+ % outputFiltered = readOutputFilter(filterHeader, filterContent, varargin )
33 %
44 % 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- % path form `cfg`.
5+ % of a target column.
76 %
87 % DEPENDENCIES:
98 % - bids_matlab (from CPP_BIDS)
109 %
1110 % INPUT:
1211 %
13- % - cfg: the main experiment structure
1412 % - filterHeader: string, the column header where the ctarget content is stored (e.g., for
1513 % 'condition name' will be 'trial type')
1614 % - filterContent: string, the content of the column you want to filter out. It can take just
1715 % part of the content name (e.g., you want to display the triggers and you have
1816 % 'trigger_motion' and 'trigger_static', 'trigger' as input will do)
17+ % - varargin: either cfg (to display the last run output) or the file path as string
1918 %
2019 % OUTPUT:
2120 %
2221 % - outputFiltered: dataset with only the specified content, to see it in the command window
2322 % use display(outputFiltered)
2423
25- % Che
24+ % Checke if input is cfg or the file path
2625 if ischar(varargin{1 })
2726 tsvFile = varargin{1 };
2827 elseif isstruct(varargin{1 })
3130 varargin{1 }.fileName.events);
3231 end
3332
34- if ~exist(tsvFile , ' file' )==2
35- error(' input file does not exist' )
33+ % Check if the file exists
34+ if ~exist(tsvFile , ' file' )
35+ error([newline ' Input file does not exist' ])
3636 end
3737
38- % % Get the outputfile path
39- % tsvFile = fullfile(cfg.dir.outputSubject, ...
40- % cfg.fileName.modality, ...
41- % cfg.fileName.events);
42-
4338 % Read the the tsv file and store each column in a field of `output` structure
4439 output = bids .util .tsvread(tsvFile );
4540
5247 % Get the dataset with the content of intereset
5348 outputFiltered = outputDataset(filterIdx , : );
5449
55- end
50+ end
0 commit comments