brainstorm3
brainstorm3 copied to clipboard
[bugfix] import snirf with event having only one occurance
Fix the following bug happening when importing a snirf where one event has only one occurrence:
Maybe its not the best fix.
***************************************************************************
** Error: Line 258: Index in position 2 exceeds array bounds. Index must not exceed 1.
**
** Call stack:
** >in_data_snirf.m at 258
** >in_fopen.m at 221
** >import_raw.m at 132
** >bst_call.m at 28
** >tree_callbacks.m>@(h,ev)bst_call(@import_raw,[],[],iSubject) at 672
**
********
Edit: maybe its not the best fix. jnirs.nirs.stim(iEvt).data should be nEvent x 3
Based on the SNIRF specification, a better approach would be to search first for the optional record /nirs(i)/stim(j)/dataLabels
to decide if transpose or not. If this is not available, transpose could be required in this condition:
if size(data, 1) < 3 && diff(size(data) < 0)
% Transpose
with the hope that if it's 3 by 3, it's correct
The code in this PR was commit directly in the master
brain in 3638bb5
@Edouard2laire, I added the code directly in the master branch to avoid double commit (code and version update)
thanks :)