Missing metabolites in .BASIS from MRSCloud

Hi everyone,
I have simulated some basis sets with MRSCloud last month. Now I have noticed that some metabolites are missing in the .basis file for LCModel (e.g. sI and mI). In the .mat file all metabolites exist.
I think that the fit_selectMetabs.m script called in io_writelcmBasis.m is the problem (MRSCloud/functions/osprey_functions/fit_selectMetabs.m at main · shui5/MRSCloud · GitHub).
The length of idx_toKeep (etc.) is oriented on metsToKeep but applied to basisSetOut.name. Because length(basisSetOut.name) can be larger than length(basisSetOut.name), the last metabolites (‘mI’, ‘sI’) can be kicked out.

A possible solution could be:
idx_toKeep = zeros(length(metsInBasisSet),1);
for kk = 1:length(metsInBasisSet)
if ~any(cellfun(@(x) strcmp(x,metsInBasisSet{kk}),metsToKeep)) || ~metabList.(metsInBasisSet{kk})
idx_toKeep(kk) = 0;
else
idx_toKeep(kk) = 1;
end
end
instead of line 59-66 of fit_selectMetabs.m and something comparable for MM.
This solves my problem, but I don’t know if it’s a general solution.

Best,
Heiner