help > Possible bug in hmrMotionCorrectPCA
Jul 10, 2018  01:07 PM | Frank Fishburn
Possible bug in hmrMotionCorrectPCA

I am testing tPCA on some simulated data and am finding that nSV sometimes gets set to 0 when the first singular value is greater than nSV, resulting in no correction being applied.  I don't think this is a common scenario, so it's probably not a major problem.  However, it looks to me like the issue is on lines 67-70:

if nSV<1 & nSV>0
    ev = diag(svsc < nSV);
    nSV = find(diag(ev)==0,1)-1;

It looks to me like it can be fixed with this change:

if nSV<1 & nSV>0
    nSV = find(svsc>=nSV,1,'first');

Hope this helps. Apologies if I missed something.