huppertt / nirs-toolbox

Toolbox for fNIRS analysis
86 stars 61 forks source link

latest update broke Wavelengths test in loadNIRx #36

Open bzinszer opened 8 months ago

bzinszer commented 8 months ago

https://github.com/huppertt/nirs-toolbox/blob/93a109d46727c6e8a3da7afb17103c4b2d91eb44/%2Bnirs/%2Bio/loadNIRx.m#L115

if(~isfield(info,'Wavelengths') || info.Wavelengths==2)

when Wavelengths is (correctly) assigned two or three values (e.g., [760 850]), the following test will return a vector output (e.g., [0 0]): info.Wavelengths==2

Although this test failed quietly in the previous version, it now crashes the function because you cannot use the || operator with non-scalar output.

Suggested fix: if(~isfield(info,'Wavelengths') || (isscalar(info.Wavelengths) && info.Wavelengths==2))