% This function is part of the NMSM Pipeline, see file for full license.
%
% This function converts the muscles portion of a parsed .osimx file
% into a new .osimx struct to be printed with writeOsimxFile(). See
% buildOsimxFromParsedOsimx() for reference.
%
% (struct, struct) -> (struct)
% Adds muscles to .osimxStruct
function osimx = buildMtpOsimx(osimx, muscles)
osimx.NMSMPipelineDocument.OsimxModel.RCNLMuscleSet.Comment = ...
'Optimized muscle parameters';
osimx.NMSMPipelineDocument.OsimxModel.RCNLMuscleSet = '';
muscleNames = fieldnames(muscles);
for i = 1:length(muscleNames)
osimx = buildRcnlMuscle(osimx, muscleNames{i}, muscles.(muscleNames{i}));
end
end