Skip to main content

saveDesignOptimizationResults.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% This function saves and prints the unscaled results from
% Design Optimization. An osim model may also be printed if model specific
% values were optimized
%
% (struct, struct) -> (None)
% Prints design optimization results


function saveDesignOptimizationResults(solution, inputs)
values = getDesignOptimizationValueStruct(solution.solution.phase, inputs);
saveCommonOptimalControlResults(solution, inputs, values)
if isfield(inputs, "systemFns")
values = getDesignOptimizationValueStruct(solution.solution.phase, inputs);
inputs.auxdata = inputs;
inputs = updateSystemFromUserDefinedFunctions(inputs, values);
model = Model(inputs.auxdata.model);
model.print(strrep(inputs.mexModel, '_inactiveMuscles.osim', 'DesignOpt.osim'));
end
end