Closed marcobarilari closed 3 years ago
have no idea how to use a switch when you input either a var or a string
from the top of my head I would do something like this.
if isstring(varargin{1})
tsvFile = varargin{1}
elseif isstruct(varargin{1})
tsvFile = fullfile(varargin{1}.dir.outputSubject, ...
varargin{1}.fileName.modality, ...
varargin{1}.fileName.events);
end
@marcobarilari
Actually, if you want to try writing a unit test, this function is perfect for it.
dummyData
folder inside the tests
directory.tests
folder (see below for a template)function test_suite = test_readOutputFilter %#ok<*STOUT>
try % assignment of 'localfunctions' is necessary in Matlab >= 2016
test_functions = localfunctions(); %#ok<*NASGU>
catch % no problem; early Matlab versions can use initTestSuite fine
end
initTestSuite;
end
function test_readOutputFilterBasic()
%% set up
cfg = ... % fill in
filterHeader = ... % fill in
filterContent = ... % fill in
outputFiltered = readOutputFilter(cfg, filterHeader, filterContent)
%% test data
expectedOutput = ... % create a structure that describes what output you expect
%% test
assertEqual(expectedOutput, outputFiltered); % make sure they match
end
I have addressed (attempt to) all the suggestions, thank :)
last commits will resolve #76
The function now can retrieve the the file path only from cfg (have no idea how to use a switch when you input either a var or a string) and can filter only string elements (no numbers at the moment).
Despite it has some limits, I think it is already at a good stage that can serve our purpose (display the triggers events at the end of the experiment).
I will open an issue with the possible improvements.
this will resolve cpp-lln-lab/localizer_visual_motion#29
LM