huppertt / nirs-toolbox

Toolbox for fNIRS analysis
89 stars 61 forks source link

Change stimulus name regexp expression for KeepStims in GLM.m. #4

Closed PeggyS closed 2 years ago

PeggyS commented 3 years ago

This fixes an error in ROC analysis when stim event is A and short or aux channels are used.

When ROC analysis is done with ShortSep channels or auxiliary regressors, an error occurs in ChannelStatsROC.m. "The logical indices contain a true value outside of the array bounds. Error in nirs.testing.ChannelStatsROC/run (line 157)". The error stems fro the stats computed on line 123. With short separation or auxiliary channels there are additional conditions included in the stats, not simply condition 'A'.

This happens because GLM.m is keeping the additional stims. The regex for stims to keep is [Stim{ii} '*']. When the Stim name is 'A', this means all shortsep channel stims (and auxiliary stims) are kept since they all include an 'A' (e.g. SS_PCA1). I changed the regexp to ['^' Stim{ii} '$'] so only exact matches of the stim name are kept, resolving the problem.