...
Often the best way of figuring out how to code is to use examples from already written scripts or functions. Many example scripts and functions can be found in the OpenSim 4.0 resources directory (Typically /Documents/OpenSim/4.0/Code/Matlab). You can also download some additional example scripts that use the current API.
plotMuscleFLCurves.m | Function to compute and plot the active and passive force-length muscle curves |
createActuatorsFile.m | Function to generate a generic OpenSim Actuator File from a Model |
build_and_simulate_simple_arm.m | Demonstrates building and simulating a simple arm model |
pendulum_marker_positions.m | Build, simulate, and generate outputs for a double-pendulum model. Writes the results to .sto and .trc files. |
...
Troubleshooting Tips
In addition to looking at example code, another great way to learn more about scripting in Matlab is to review the OpenSim Doxygen. The doxygen documents all the functionality of the OpenSim API. Guide to Using Doxygen.
...