Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
anaflom opened this issue Oct 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@anaflom
Copy link

anaflom commented Oct 21, 2024

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 anaflom added the bug Something isn't working label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant