how can I define a PiecewiseConstantFunctio using Matlab API

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Sina Porsa
Posts: 99
Joined: Thu Feb 03, 2011 7:21 pm

how can I define a PiecewiseConstantFunctio using Matlab API

Post by Sina Porsa » Wed Aug 28, 2013 12:27 am

Hi every one
I am trying to create a PiecewiseConstantFunction within a Matlab script:

Code: Select all

 PiecewiseConstantFunction(nNodes, tVec, U)

where nNodes is an integer and tVec&U are two vectors (size = 1xnNodes)
When I run my script, it returns this error:
??? No constructor 'org.opensim.modeling.PiecewiseConstantFunction' with matching
signature found.
I tried to replace tVec and U with two matching org.opensim.modeling.ArrayDoubles which didn't solve the problem.
Any ideas?
Thanks
Sina

User avatar
Ayman Habib
Posts: 2248
Joined: Fri Apr 01, 2005 12:24 pm

Re: how can I define a PiecewiseConstantFunctio using Matlab

Post by Ayman Habib » Wed Aug 28, 2013 1:29 pm

Hi,

The PiecewiseConstantFunction class has no constructors that take Vector or ArrayDouble, instead it takes double* which is not a Java, Python or scripting construct. Your best bet is to use a sequence of calls similar to the code block below (pulled from one of our examples):

Code: Select all

          
            PiecewiseConstantFunction bangBangControl;
            bangBangControl.addPoint(initialTime,0);
Hope this helps,
-Ayman

User avatar
Sina Porsa
Posts: 99
Joined: Thu Feb 03, 2011 7:21 pm

Re: how can I define a PiecewiseConstantFunctio using Matlab

Post by Sina Porsa » Wed Aug 28, 2013 5:50 pm

Thanks dear Ayman.

POST REPLY