Homer3 icon indicating copy to clipboard operation
Homer3 copied to clipboard

[BUG]: hmrR_MotionCorrectWavelet gives an error when data has more channels than samples

Open anaflom opened this issue 4 months ago • 0 comments

Version of Homer3 you are using

Homer3 v1.80.2;

Your environment (MATLAB environment and OS)

MATLAB Runtime R2024a; Windows 11 Pro 64-bit 23H2

Description of the issue

The function hmrR_MotionCorrectWavelet raises the error "Index exceeds the number of array elements" due to the incompatible size of the assignment in line 111 when the data has more channels than samples (as might happen in HD systems). dodWavelet(:,idx_ch) = ARSignal(1:length(dod));

The issue arises because "length", for a matrix, returns max(size(dod)), but what is needed is the size of the first dimension (samples) The line should be replaced by dodWavelet(:,idx_ch) = ARSignal(1:size(dod,1));

Steps to reproduce: run data_dod = hmrR_MotionCorrectWavelet(data_dod, [], [], iqr) with size(data_dod.dataTimeSeries,1) < size(data_dod.dataTimeSeries,2)

Expected behavior: The function should work properly (as it does when size(data_dod.dataTimeSeries,1) > size(data_dod.dataTimeSeries,2))

Actual behavior: The function raises the error

Index exceeds the number of array elements. Index must not exceed XXX.

Error in hmrR_MotionCorrectWavelet (line 111) dodWavelet(:,idx_ch) = ARSignal(1:length(dod));

anaflom avatar Oct 21 '24 14:10 anaflom