Accessing instance name via MATLAB/parametric diagram

Moderator: Moderators

Accessing instance name via MATLAB/parametric diagram

Postby ohs18 » Wed Feb 24, 2021 2:04 pm

Hello,

I have a parametric diagram that calls a MATLAB function as its constraint. When I evaluate and simulate an instance in my model, this MATLAB function accesses the various slot values of the instance to perform different evaluations. However, I would also like the name of the instance specification I am running to be an input into this function. Is there a way to access and pass the name of instance specification into the constraint equation defined by my MATLAB function? I know I could make another value property for my classifier block of the instance, but I want to try to avoid doing this, as I have many instances I would have to do this with and would be a laborious task. Are there a few lines of code that could accomplish this task instead?

Thanks for the help.
ohs18
Forum Newbie
Forum Newbie
 
Posts: 17
Posts Rating:1
Joined: Wed Jan 20, 2021 7:08 pm

Re: Accessing instance name via MATLAB/parametric diagram

Postby saulius_p » Wed Feb 24, 2021 5:12 pm

Hello,

Thank you for your question. I think it is not so easy as only value properties / slots can be used in Matlab integration and simulation. Name is metalevel property. You can copy name to value property or ever create value property with custom script.

Sincerely,
Saulius
Best regards,
Saulius Pavalkis
User avatar
saulius_p
No Magic
No Magic
 
Posts: 311
Posts Rating:12
Joined: Fri Dec 04, 2009 5:37 am
Full name: Saulius Pavalkis

Re: Accessing instance name via MATLAB/parametric diagram

Postby ohs18 » Wed Feb 24, 2021 5:20 pm

Ok that makes sense. Can you use MATLAB to create a value property in the custom script? If so, what would that script look like? I'm not familiar with creating a value property through a MATLAB script.

Also, As a follow-up, is there a better programming language to use that can access the name of the instance as opposed to MATLAB?

Thank you for the response and the help.
ohs18
Forum Newbie
Forum Newbie
 
Posts: 17
Posts Rating:1
Joined: Wed Jan 20, 2021 7:08 pm


Return to Cameo Simulation Toolkits

Who is online

Users browsing this forum: Google [Bot] and 0 guests