[592feb]: / MATLAB_tool / MuscleParOptTool / getChildBodyJoint.m

Download this file

27 lines (20 with data), 911 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
% functon to return the name of the joint from a specified model and joint
% structure ( generatate using getModelJointDefinitions.m ) , where the
% specified body is the child body
% Written by Bryce Killen bryce.killen@kuleuven.be as part of an extension
% of work by Luca Modenese in the parameterisation of muscle tendon
% properties
% Input: OpenSim model objects
% Output: jointName - the joint where the specified body is the child
function jointName = getChildBodyJoint(jointStructure, bodyName)
% return a list of the joints
allJoints = fieldnames(jointStructure);
% loop through joints to check the child body entry and return if true
% NOTE: inefficient but will work temp.
for j = 1:length(allJoints)
if strcmp(jointStructure.(char(allJoints(j))).childBody , bodyName)
jointName = char(allJoints(j));
return
end
end
end