Page 1 of 1

Data access

Posted: Wed Jan 08, 2014 6:35 am
by alisy
Hi,
I would like to plot the force-velocity curve and extract other values using scripting commands. I tried to used the MATLAB and GUI interfaces to access some data, I used printMuscleCurveToCSVFile (const std::string &path) in the ForceVelocityCurve method to print out the force velocity curve to an external file, but it did not work.
If there any way to plot out this curve or to save it in an output file?

Thanks
Ali

Re: Data access

Posted: Wed Jan 08, 2014 5:36 pm
by jp123909
hi,

try this

Code: Select all

Model osimModel( "YourModel.osim" );
Millard2012EquilibriumMuscle * m = dynamic_cast<Millard2012EquilibriumMuscle*>(&osimModel.getMuscles().get(0));
m->upd_FiberForceLengthCurve().printMuscleCurveToCSVFile("");

result:
x y dy/dx d2y/dx2
0.9 0 0 0
0.91 0 0 0
0.92 0 0 0
0.93 0 0 0
0.94 0 0 0
0.95 0 0 0
0.96 0 0 0
0.97 0 0 0
0.98 0 0 0
0.99 0 0 0
1 0 0 0
1.00061 1.07E-08 5.35E-05 0.181842
1.00119 8.40E-08 0.000218195 0.388925
1.00175 2.79E-07 0.000499912 0.622249
1.00229 6.52E-07 0.000904135 0.88248
1.00281 1.25E-06 0.00143578 1.16988
1.00331 2.13E-06 0.00209912 1.48424
1.00379 3.33E-06 0.00289765 1.82483
1.00426 4.90E-06 0.003834 2.19034
1.00471 6.87E-06 0.00490986 2.57887
1.00515 9.27E-06 0.00612585 2.98791
1.00557 1.22E-05 0.00748152 3.41435
1.00598 1.55E-05 0.00897525 3.85452
1.00638 1.94E-05 0.0106043 4.30426
1.00677 2.39E-05 0.0123646 4.75898
1.00715 2.89E-05 0.0142512 5.21382
1.00752 3.45E-05 0.0162579 5.66372
1.00788 4.08E-05 0.0183775 6.10361
1.00823 4.76E-05 0.020602 6.52849
1.00858 5.51E-05 0.0229227 6.93367
1.00892 6.33E-05 0.02533 7.31482
1.00925 7.21E-05 0.0278142 7.66813
1.00957 8.16E-05 0.030365 7.99041
1.00989 9.17E-05 0.0329721 8.27915
1.01021 0.000102523 0.0356252 8.53261
1.01052 0.000114023 0.0383143 8.74977
1.01083 0.000126203 0.0410296 8.93039
1.01113 0.000139065 0.0437619 9.07493
1.01143 0.000152607 0.0465024 9.18453
1.01173 0.000166829 0.0492431 9.2609
1.01202 0.000181728 0.0519769 9.30628
1.01231 0.000197301 0.0546972 9.32329
1.0126 0.000213544 0.0573985 9.31491
1.01289 0.000230453 0.060076 9.28429
1.01318 0.000248023 0.0627261 9.23476
1.01346 0.000266249 0.0653456 9.16969
1.01374 0.000285127 0.0679324 9.0924
1.01403 0.000304651 0.0704853 9.00616
1.01431 0.000324816 0.0730037 8.91411
1.01459 0.000345616 0.0754878 8.81917
1.01487 0.000367048 0.0779383 8.72411
1.01515 0.000389107 0.0803567 8.63142
1.01542 0.000411789 0.0827449 8.54338
1.0157 0.00043509 0.0851054 8.462
1.01598 0.000459009 0.087441 8.38902
1.01626 0.000483542 0.0897551 8.32596
1.01653 0.000508691 0.092051 8.27403
1.01681 0.000534454 0.0943325 8.23423
1.01709 0.000560833 0.0966037 8.20729
1.01736 0.000587831 0.0988686 8.1937
1.01764 0.000615451 0.101131 8.1937
1.01791 0.000643699 0.103396 8.20729
1.01819 0.000672582 0.105667 8.23423
1.01847 0.000702109 0.107949 8.27403
1.01874 0.00073229 0.110245 8.32596
1.01902 0.000763137 0.112559 8.38902
1.0193 0.000794666 0.114895 8.462
1.01958 0.000826892 0.117255 8.54338
1.01985 0.000859835 0.119643 8.63142
1.02013 0.000893516 0.122062 8.72411
1.02041 0.000927958 0.124512 8.81917
1.02069 0.000963188 0.126996 8.91411
1.02097 0.000999234 0.129515 9.00616
1.02126 0.00103613 0.132068 9.0924
1.02154 0.00107391 0.134654 9.16969
1.02182 0.0011126 0.137274 9.23476
1.02211 0.00115226 0.139924 9.28429
1.0224 0.00119293 0.142602 9.31491
1.02269 0.00123465 0.145303 9.32329
1.02298 0.00127747 0.148023 9.30628
1.02327 0.00132145 0.150757 9.2609
1.02357 0.00136664 0.153498 9.18453
1.02387 0.00141312 0.156238 9.07493
1.02417 0.00146094 0.15897 8.93039
1.02448 0.00151017 0.161686 8.74977
1.02479 0.00156089 0.164375 8.53261
1.02511 0.00161317 0.167028 8.27915
1.02543 0.00166711 0.169635 7.99041
1.02575 0.00172278 0.172186 7.66813
1.02608 0.00178027 0.17467 7.31482
1.02642 0.00183969 0.177077 6.93367
1.02677 0.00190114 0.179398 6.52849
1.02712 0.00196471 0.181622 6.10361
1.02748 0.00203053 0.183742 5.66372
1.02785 0.0020987 0.185749 5.21382
1.02823 0.00216935 0.187635 4.75898
1.02862 0.00224261 0.189396 4.30426
1.02902 0.0023186 0.191025 3.85452
1.02943 0.00239747 0.192518 3.41435
1.02985 0.00247935 0.193874 2.98791
1.03029 0.00256441 0.19509 2.57887
1.03074 0.00265278 0.196166 2.19034
1.03121 0.00274464 0.197102 1.82483
1.03169 0.00284015 0.197901 1.48424
1.03219 0.00293948 0.198564 1.16988
1.03271 0.00304281 0.199096 0.88248
1.03325 0.00315034 0.1995 0.622249
1.03381 0.00326224 0.199782 0.388925
1.03439 0.00337873 0.199946 0.181842
1.035 0.0035 0.2 -9.33E-17
1.04678 0.00585918 0.20068 0.118838
1.05811 0.00814197 0.202771 0.254198
1.069 0.0103681 0.206348 0.406773
1.07948 0.0125561 0.211483 0.577045
1.08957 0.0147234 0.218237 0.765242
1.0993 0.0168866 0.226666 0.971299
1.10869 0.0190611 0.236817 1.19482
1.11776 0.0212612 0.248724 1.43503
1.12653 0.0235005 0.262411 1.69079
1.13502 0.0257915 0.277889 1.96056
1.14324 0.0281458 0.295154 2.24239
1.15122 0.0305742 0.31419 2.53399
1.15896 0.0330867 0.334965 2.83272
1.16649 0.0356923 0.357431 3.13566
1.17382 0.0383996 0.381527 3.43967
1.18097 0.041216 0.40718 3.74148
1.18794 0.0441485 0.434302 4.03777
1.19475 0.0472034 0.462794 4.32526
1.20142 0.0503863 0.492546 4.60082
1.20795 0.0537022 0.523442 4.86154
1.21435 0.0571553 0.555359 5.10482
1.22064 0.0607497 0.588169 5.32844
1.22682 0.0644887 0.621742 5.53062
1.23291 0.068375 0.655948 5.71006
1.2389 0.0724111 0.690658 5.86594
1.24481 0.0765989 0.72575 5.99793
1.25065 0.08094 0.761103 6.10618
1.25643 0.0854356 0.796607 6.1913
1.26214 0.0900866 0.832157 6.25428
1.26779 0.0948936 0.86766 6.29647
1.2734 0.0998569 0.903031 6.31953
1.27896 0.104976 0.938198 6.32532
1.28448 0.110252 0.973098 6.3159
1.28997 0.115684 1.00768 6.29343
1.29542 0.121271 1.04191 6.26011
1.30084 0.127013 1.07574 6.21818
1.30624 0.132909 1.10917 6.16982
1.31161 0.138959 1.14219 6.11714
1.31697 0.145162 1.1748 6.06215
1.3223 0.151516 1.207 6.00674
1.32762 0.158023 1.23881 5.95265
1.33293 0.16468 1.27026 5.90146
1.33822 0.171487 1.30138 5.85458
1.34351 0.178445 1.3322 5.81328
1.34878 0.185553 1.36277 5.77863
1.35405 0.192811 1.39313 5.75153
1.35931 0.200219 1.42333 5.73273
1.36456 0.207778 1.45343 5.72278
1.36982 0.215489 1.48348 5.7221
1.37506 0.223353 1.51352 5.7309
1.38031 0.231371 1.54363 5.74924
1.38555 0.239546 1.57385 5.77703
1.3908 0.24788 1.60424 5.81396
1.39604 0.256375 1.63485 5.8596
1.40129 0.265035 1.66574 5.91329
1.40654 0.273864 1.69695 5.97423
1.4118 0.282866 1.72852 6.0414
1.41706 0.292046 1.7605 6.11361
1.42233 0.301409 1.79292 6.18946
1.42761 0.310963 1.82581 6.26738
1.4329 0.320713 1.85918 6.34561
1.43821 0.330667 1.89305 6.42218
1.44353 0.340834 1.92743 6.49501
1.44887 0.351222 1.96231 6.56182
1.45424 0.361842 1.99767 6.62025
1.45963 0.372705 2.03348 6.66785
1.46504 0.383821 2.06971 6.70213
1.4705 0.395204 2.1063 6.72061
1.47598 0.406866 2.1432 6.72088
1.48152 0.418823 2.18033 6.70068
1.48709 0.431089 2.21759 6.65794
1.49272 0.443681 2.25491 6.5909
1.49841 0.456616 2.29215 6.49813
1.50417 0.469913 2.32921 6.37862
1.50999 0.483592 2.36596 6.23185
1.5159 0.497673 2.40227 6.0578
1.52189 0.512178 2.43798 5.85705
1.52798 0.52713 2.47297 5.63072
1.53418 0.542554 2.50708 5.38051
1.54049 0.558476 2.54017 5.10864
1.54692 0.574921 2.57211 4.81784
1.55349 0.59192 2.60276 4.51122
1.5602 0.609501 2.63199 4.19224
1.56708 0.627695 2.65969 3.8646
1.57413 0.646535 2.68575 3.53207
1.58136 0.666056 2.71009 3.19848
1.5888 0.686291 2.73264 2.86752
1.59645 0.707279 2.75332 2.54269
1.60433 0.729058 2.77211 2.22721
1.61246 0.751668 2.78897 1.92393
1.62086 0.775151 2.80389 1.63529
1.62954 0.79955 2.81689 1.36329
1.63853 0.82491 2.82798 1.10946
1.64783 0.851278 2.83719 0.874881
1.65749 0.878702 2.84458 0.660197
1.66751 0.907234 2.85019 0.465644
1.67792 0.936924 2.85411 0.291099
1.68874 0.967828 2.8564 0.136119
1.7 1 2.85714 0
1.70778 1.02222 2.85714 0
1.71556 1.04444 2.85714 0
1.72333 1.06667 2.85714 0
1.73111 1.08889 2.85714 0
1.73889 1.11111 2.85714 0
1.74667 1.13333 2.85714 0
1.75444 1.15556 2.85714 0
1.76222 1.17778 2.85714 0
1.77 1.2 2.85714 0