Page 1 of 1

Matlab interface

Posted: Wed Mar 08, 2017 5:52 am
by jmat
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

Re: Matlab interface

Posted: Wed Mar 08, 2017 6:52 am
by mitkof6
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.*  

Re: Matlab interface

Posted: Wed Mar 08, 2017 6:58 am
by jmat
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

Re: Matlab interface

Posted: Tue Oct 30, 2018 6:44 am
by mritula
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

Re: Matlab interface

Posted: Tue Oct 30, 2018 6:54 am
by tkuchida
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

Re: Matlab interface

Posted: Tue Oct 30, 2018 6:57 am
by mritula
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

Re: Matlab interface

Posted: Tue Oct 30, 2018 11:17 am
by tkuchida
Please see the example scripts here: https://simtk-confluence.stanford.edu/d ... pleScripts

Re: Matlab interface

Posted: Mon Mar 25, 2019 3:56 pm
by mritula
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

Re: Matlab interface

Posted: Tue Mar 26, 2019 7:02 am
by tkuchida
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