|
32 | 32 | % 29 Nov 2018: created based on functions for other purposes and added to |
33 | 33 | % MFD Matlab toolbox. |
34 | 34 | % ------------------------------------------------------------------------% |
35 | | -function MFDStruct = muscleForceDirection_plugin(osimModel_name,... |
| 35 | +function [MFD, MFDSumStruct] = getMuscleForceDirection(osimModel_name,... |
36 | 36 | IK_mot_file,... |
37 | 37 | bodyOfInterest_name,... |
38 | 38 | bodyExpressResultsIn_name,... |
|
127 | 127 | if strcmp(visualise, 'true') |
128 | 128 | osimModel.updVisualizer().show(state_new); |
129 | 129 | end |
| 130 | + |
130 | 131 | % counter for muscles to be kept at each frame |
131 | 132 | n_keep = 1; |
132 | 133 |
|
|
185 | 186 |
|
186 | 187 | % first body outside the body of interest |
187 | 188 | bodyFrom = osimModel.getBodySet.get(mus_bodyset_list{dist_attach+1}); |
| 189 | + |
188 | 190 | % vector in bodyFrom ref system |
189 | 191 | p = Vec3(mus_pointset_mat(dist_attach+1, 1),... |
190 | 192 | mus_pointset_mat(dist_attach+1, 2),... |
|
252 | 254 | % selected body where the attachment is located outwards. The body in whose |
253 | 255 | % reference system the vector is expressed is always reported as the final |
254 | 256 | % part of the column header of each muscle. |
255 | | -MFD_vectors.colheaders = colheaders_MFD_vec; |
256 | | -MFD_vectors.data = mus_info_mat(:, :, 3); |
| 257 | +MFD.vectors.colheaders = colheaders_MFD_vec; |
| 258 | +MFD.vectors.data = mus_info_mat(:, :, 3); |
257 | 259 |
|
258 | 260 | %--------------------------------------- |
259 | 261 | % MuscleForceDirection_attachments.sto | |
|
262 | 264 | % attachments. If the user choice is to express the anatomical muscle |
263 | 265 | % attachments in the local reference system, the file will contain the |
264 | 266 | % first and last muscle points specified for that muscle in the original model file. |
265 | | -MFD_attachments.colheaders = colheaders_MFD_attach; |
266 | | -if strcmp(effective_attachm, 'true') |
267 | | - MFD_attachments.data = mus_info_mat(:, :, 1); |
268 | | -else |
269 | | - MFD_attachments.data = mus_info_mat(:, :, 2); |
270 | | -end |
| 267 | + |
| 268 | +MFD.anatom_attach.colheaders = colheaders_MFD_attach; |
| 269 | +MFD.anatom_attach.data = mus_info_mat(:, :, 1); |
| 270 | + |
| 271 | +MFD.effect_attach.colheaders = colheaders_MFD_attach; |
| 272 | +MFD.effect_attach.data = mus_info_mat(:, :, 2); |
| 273 | + |
| 274 | +MFD.transp_mom.colheaders = colheaders_MFD_vec; |
| 275 | +MFD.transp_mom.data = mus_info_mat(:, :, 4); |
| 276 | +% |
| 277 | +% if strcmp(effective_attachm, 'true') |
| 278 | +% |
| 279 | +% else |
| 280 | +% |
| 281 | +% end |
271 | 282 |
|
272 | 283 | %-------------------------- |
273 | 284 | % Advanced MATLAB summary | |
|
278 | 289 | colheaders = {'bone_attach_X', 'bone_attach_Y', 'bone_attach_Z', 'effect_attach_X', 'effect_attach_Y', 'effect_attach_Z', ... |
279 | 290 | 'act_line_X', 'act_line_Y', 'act_line_Z', 'trans_mom_X', 'trans_mom_Y', 'trans_mom_Z'}; |
280 | 291 | % this is an advanced summary for Matlab use |
281 | | -MFDStruct.colheaders = colheaders; |
282 | | -MFDStruct.rowheaders = rowheaders; |
283 | | -MFDStruct.data = mus_info_mat; |
| 292 | +MFDSumStruct.colheaders = colheaders; |
| 293 | +MFDSumStruct.rowheaders = rowheaders; |
| 294 | +MFDSumStruct.data = mus_info_mat; |
284 | 295 |
|
285 | 296 | % to free the memory |
286 | 297 | osimModel.disownAllComponents(); |
|
0 commit comments