Matlab interface

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Jum Wld
Posts: 15
Joined: Tue Jan 31, 2017 10:14 am

Matlab interface

Post by Jum Wld » Wed Mar 08, 2017 5:52 am

Hello,

I am trying to configure the interface between MATLAB and OpenSim. I followed the instruction of manual configuration (http://simtk-confluence.stanford.edu:80 ... ith+Matlab). I tried the command:
import org.opensim.modeling.*
and there was no error.
When I tried : org.opensim.modeling.Model OR methods Model

I got :
undefined variable "org" or class "org.opensim.modeling.Model" OR No class Model.

Can anyone advice?

Thanks alot

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Matlab interface

Post by Dimitar Stanev » Wed Mar 08, 2017 6:52 am

Make sure that your Matlab setup is working properly by running some of the scripts in \Scripts\Matlab folder. If you have configured Matlab with OpenSim correctly then you need to import the OpenSim libraries before using them:

Code: Select all

import org.opensim.modeling.*  

User avatar
Jum Wld
Posts: 15
Joined: Tue Jan 31, 2017 10:14 am

Re: Matlab interface

Post by Jum Wld » Wed Mar 08, 2017 6:58 am

It was not working with the examples even that I used ---> import org.opensim.modeling.* before the code.
The problem was in the PC administrator rights. I have sorted it out

Many thanks

User avatar
Mritula Chandrasekaran
Posts: 94
Joined: Tue Dec 19, 2017 5:36 am

Re: Matlab interface

Post by Mritula Chandrasekaran » Tue Oct 30, 2018 6:44 am

Hi There,
I am facing the same problem as well. Can you help me how to work it out? I did "import org.opensim.modeling.* " this did not give an error.

But when I do model=org.opensim.modelling.Model()
Undefined variable "org" or class "org.opensim.modelling.Model". It gives an error.

Thanks,
Mritula

User avatar
Thomas Uchida
Posts: 1777
Joined: Wed May 16, 2012 11:40 am

Re: Matlab interface

Post by Thomas Uchida » Tue Oct 30, 2018 6:54 am

But when I do model=org.opensim.modelling.Model()
That line gives me an error as well because "modelling" should be spelled "modeling". Regardless, if you've imported the OpenSim libraries with "import org.opensim.modeling.*", you just need to do this:

Code: Select all

import org.opensim.modeling.*;
model = Model();
Please see the example MATLAB scripts and these pages in the Confluence documentation:
- "Scripting": https://simtk-confluence.stanford.edu/d ... /Scripting
- "Common Scripting Commands": https://simtk-confluence.stanford.edu/d ... g+Commands
- "Scripting with Matlab": https://simtk-confluence.stanford.edu/d ... ith+Matlab

User avatar
Mritula Chandrasekaran
Posts: 94
Joined: Tue Dec 19, 2017 5:36 am

Re: Matlab interface

Post by Mritula Chandrasekaran » Tue Oct 30, 2018 6:57 am

Thanks for that. Silly me. Sorry. It worked now. It gave me an output as

model =
model

Is this all that was expected?

Thanks,
Mritula

User avatar
Thomas Uchida
Posts: 1777
Joined: Wed May 16, 2012 11:40 am

Re: Matlab interface

Post by Thomas Uchida » Tue Oct 30, 2018 11:17 am

Please see the example scripts here: https://simtk-confluence.stanford.edu/d ... pleScripts

User avatar
Mritula Chandrasekaran
Posts: 94
Joined: Tue Dec 19, 2017 5:36 am

Re: Matlab interface

Post by Mritula Chandrasekaran » Mon Mar 25, 2019 3:56 pm

Hi,
Where can I find details about the package org.opensim.modeling. I want to create a simple model representing a plain skeletal figure in Opensim. How can I do that? I tried through the examples in Matlab. They have C++ codes inside them. But most of them are from the above package. Where can I find any documentation related to it listing the details of the methods in this pacakage.

Thanks
Mritula

User avatar
Thomas Uchida
Posts: 1777
Joined: Wed May 16, 2012 11:40 am

Re: Matlab interface

Post by Thomas Uchida » Tue Mar 26, 2019 7:02 am

The main OpenSim documentation page is here: https://simtk-confluence.stanford.edu/d ... umentation
The User's Guide is here: https://simtk-confluence.stanford.edu/d ... er's+Guide
The most relevant documentation for Matlab scripting users can be found here:
- "Common Scripting Commands" (https://simtk-confluence.stanford.edu/d ... g+Commands)
- "Scripting with Matlab" (https://simtk-confluence.stanford.edu/d ... ith+Matlab)
The programmer's documentation is here: https://simtk.org/api_docs/opensim/api_docs/
Some additional information can be found on GitHub: https://github.com/opensim-org/opensim-core

POST REPLY