Skip to main content

calcDifferencesInEmgGroups.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% A cost is calculcated to discourage differences between the emgScaling
% factors for grouped muscles
%
% (array of number, array of string) -> (array of number)
% calculates the cost of differences in EMG groups


function deviationsEMGScale = calcDifferencesInEmgGroups( ...
emgScale, activationGroups)

Ind = 1;
for i = 1:length(activationGroups)
deviationsEMGScale(:, Ind:Ind + size(activationGroups{i}, 2) - 1) = ...
calcMeanDifference2D(emgScale(activationGroups{i}));
Ind = Ind + size(activationGroups{i}, 2);
end
end