Skip to main content

getMuscleNameByGroupStruct.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% This function creates a struct where each fieldname corresponds to a list
% of the muscle names in that muscle group for a given model.
%
% (Model, Array of string) -> (struct)
% Get name to group relationship struct from model and group names


function groupToName = getMuscleNameByGroupStruct(model, emgDataNames)
for i=1:length(emgDataNames) % struct group names with muscle names inside
groupSize = model.getForceSet().getGroup(emgDataNames(i)) ...
.getMembers().size();
groupToName.(emgDataNames(i)) = string(zeros(1,groupSize));
for j=0:groupSize-1
groupToName.(emgDataNames(i))(j+1) = model.getForceSet() ...
.getGroup(emgDataNames(i)).getMembers().get(j).getName() ...
.toCharArray';
end
end
end