The code I posted above was using the latest development version of OpenSim, so I didn't have your issue. I went back and tested the 4.0 version and saw the issue that you are describing. We obviously didn't catch this bug when we released, but it was subsequently fixed during a different overhaul.
As of now, you won't be able to construct a ForceSet from a force set file (.xml) in Matlab. One workaround you could do is to modify the createActuatorsFile.m file so it returns a ForceSet object (as well as printing to file). I have attached a version of the Matlab function that does that. You could then make modifications to the ForceSet object in memory and re-print.
Code: Select all
% Construct a ForceSet object from a Model.
forceset = createActuatorsFile_ReturnForceSet(path2Model)
% Make modifications to the ForceSet
...
% Write to file
forceset.print('path2writeFile.xml')
Thanks,
-J