% This function is part of the NMSM Pipeline, see file for full license.
%
% This function calculates the difference between the starting and final
% external moment (ground reaction moments for now) for the specified foot
% and moment.
%
% (Cell, struct, Array of string) -> (Number)
%
function externalMomentsPeriodicity = calcExternalMomentsPeriodicity( ...
groundReactionMoments, contactSurfaces, momentName)
for i = 1:length(contactSurfaces)
indx = find(strcmp(convertCharsToStrings( ...
contactSurfaces{i}.momentColumns), momentName));
if ~isempty(indx)
externalMomentsPeriodicity = diff(groundReactionMoments{i}(:, indx));
end
end
end