Skip to main content

writeReplacedExperimentalGroundReactionsToSto.m


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


function writeReplacedExperimentalGroundReactionsToSto(inputs, ...
resultsDirectory, modelName)
columnLabels = ["Fx" "Fy" "Fz" "Mx" "My" "Mz" "ECx" "ECy" "ECz"];
for foot = 1:length(inputs.surfaces)
data = inputs.surfaces{foot}.experimentalGroundReactionForces';
data = [data inputs.surfaces{foot}.experimentalGroundReactionMoments'];
% [~, markerPositions] = ...
% makeFootKinematics(inputs.bodyModel, ...
% inputs.motionFileName, ...
% inputs.surfaces{foot}.coordinatesOfInterest, ...
% inputs.surfaces{foot}.hindfootBodyName, ...
% inputs.surfaces{foot}.toesCoordinateName, ...
% inputs.surfaces{foot}.markerNames, ...
% inputs.surfaces{foot}.time(1), inputs.surfaces{foot}.time(end), ...
% inputs.surfaces{foot}.isLeftFoot);
% markerPositions.midfootSuperior(2, :) = inputs.restingSpringLength;
data = [data inputs.surfaces{foot}.experimentalMomentCenter'];
writeToSto(columnLabels, inputs.surfaces{foot}.time, data, ...
fullfile(resultsDirectory, strcat(modelName, "_Foot_", ...
num2str(foot), "_replacedExperimentalGroundReactions.sto")));
end
end