Skip to main content

writeOptimizedFootKinematicsToSto.m


% This function is part of the NMSM Pipeline, see file for full license.
%
%
%
% (struct, string, string) -> (None)
% Write modeled foot kinematics to an OpenSim Storage file.


function writeOptimizedFootKinematicsToSto(inputs, resultsDirectory, ...
modelName)
for foot = 1:length(inputs.surfaces)
columnLabels = [convertCharsToStrings(inputs.surfaces{foot} ...
.toesCoordinateName), "Rotation1", "Rotation2", "Rotation3", ...
"Translation1", "Translation2", "Translation3"];
[modeledJointPositions, ~] = calcGCPJointKinematics( ...
inputs.surfaces{foot}.experimentalJointPositions, ...
inputs.surfaces{foot}.jointKinematicsBSplines, ...
inputs.surfaces{foot}.bSplineCoefficients);
writeToSto( ...
columnLabels, ...
inputs.surfaces{foot}.time, ...
modeledJointPositions', ...
fullfile(resultsDirectory, strcat(modelName, "_Foot_", ...
num2str(foot), "_optimizedFootKinematics.sto")));
end

end