Skip to content

Commit 111a993

Browse files
committed
add check for input and file existence
1 parent c257e6f commit 111a993

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/readOutputFilter.m

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function outputFiltered = readOutputFilter(varargin, filterHeader, filterContent)
1+
function outputFiltered = readOutputFilter(filterHeader, filterContent, varargin)
22
% outputFiltered = readOutputFilter(cfg, filterHeader, filterContent)
33
%
44
% It will display in the command window the content of the `output.tsv' filtered by one element
@@ -21,15 +21,20 @@
2121
%
2222
% - outputFiltered: dataset with only the specified content, to see it in the command window
2323
% use display(outputFiltered)
24-
25-
if isstring(varargin{1})
26-
tsvFile = varargin{1}
24+
25+
% Che
26+
if ischar(varargin{1})
27+
tsvFile = varargin{1};
2728
elseif isstruct(varargin{1})
2829
tsvFile = fullfile(varargin{1}.dir.outputSubject, ...
2930
varargin{1}.fileName.modality, ...
3031
varargin{1}.fileName.events);
3132
end
3233

34+
if ~exist(tsvFile, 'file')==2
35+
error('input file does not exist')
36+
end
37+
3338
% % Get the outputfile path
3439
% tsvFile = fullfile(cfg.dir.outputSubject, ...
3540
% cfg.fileName.modality, ...

0 commit comments

Comments
 (0)