Xiu: I stumbled on the code you're looking for. It's in plscvfold.m;
groups = 1+rem(0:Mx-1,K);
testk = find(groups==group); calk = find(groups~=group);
@Xiu: I'm not familiar with Bayesian or FDA, but isn't the problem you're describing because the DM2 data is already pretreated/scaled?
Maybe by something like:
The code has been very helpful. However, I do have a question on the example you included. The test_package_functions.m calls data DM2 which contains two variables Xcal and ycal. The ycal only has numbers either +1 or -1, which works out nicely in the ldapinv.m (performs bayesian approximation or FDA). I don't quite understand it here since I'm not familiar with Bayesian approximation or FDA. When I have my own dataset, which means my y would have numbers other than +/-1, the formation of XX has dimensionality problem. I believe this is due to both B, kp, and kn are empty matrices (matrices of locations of +/-1 elements). The influence of this result extends further into the plslda.m. How should I fix this problem if I want to use my own data? Please help me with this.