Skip to content

Commit e373e36

Browse files
committed
fix tests
1 parent 466e6ef commit e373e36

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

src/readAndFilterLogfile.m

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,19 @@
1414
% :param columnName: the header of the column where the content of interest is stored
1515
% (for example for ``trigger`` will be ``trial type``)
1616
% :type columnName: string
17+
%
1718
% :param filterBy: the content of the column you want to filter out. It can take just
1819
% part of the content name (for example, if you want to display the triggers
1920
% and you have ``trigger_motion`` and ``trigger_static``,
2021
% ``trigger`` as input will do)
2122
% :type filterBy: string
23+
%
2224
% :param saveOutputTsv: flag to save the filtered output in a tsv file
2325
% :type saveOutputTsv: boolean
26+
%
2427
% :param tsvFile: TSV file to filter
2528
% :type tsvFile: string
29+
%
2630
% :param cfg: Configuration. See ``checkCFG()``. If ``cfg`` is given as input the name
2731
% of the TSV file to read will be infered from there.
2832
% :type cfg: structure
@@ -67,7 +71,7 @@
6771
output = bids.util.tsvread(tsvFile);
6872
end
6973

70-
% Get the index of the target contentent to filter and display
74+
% Get the index of the target content to filter and display
7175
filterIdx = strncmp(output.(columnName), filterBy, length(filterBy));
7276

7377
% apply the filter
@@ -76,8 +80,6 @@
7680
output.(listFields{iField})(~filterIdx) = [];
7781
end
7882

79-
output = convertStruct(output);
80-
8183
% Convert the structure to dataset
8284
try
8385
outputFiltered = struct2dataset(output);
@@ -93,21 +95,3 @@
9395
end
9496

9597
end
96-
97-
function structure = convertStruct(structure)
98-
% changes the structure
99-
%
100-
% from struct.field(i,1) to struct(i,1).field(1)
101-
102-
fieldsList = fieldnames(structure);
103-
tmp = struct();
104-
105-
for iField = 1:numel(fieldsList)
106-
for i = 1:numel(structure.(fieldsList{iField}))
107-
tmp(i, 1).(fieldsList{iField}) = structure.(fieldsList{iField})(i, 1);
108-
end
109-
end
110-
111-
structure = tmp;
112-
113-
end

0 commit comments

Comments
 (0)