How to use object instances in embedded matlab function
Ältere Kommentare anzeigen
I have question very similar to the below four year old post.
I have a similar problem. Interpreted matlab function block serves the purpose but it slows down the simulation. I tried using 'coder.extrinsic' in embedded matlab function block but i get list of error in 'make', 'parse' and 'coder'.
Problem Description: I have loaded an object called 'ice' in 'masked workspace'. I want to call 'ice.Tmax(u)' in simulink (where 'u' changes with time). Interpreted matlab function block works fine, but it slows down the simulation. I have many such blocks in my model, so i want to use some other block that is quick.
How do i use embedded matlab function block for this purpose ? I tried assigning the object to base workspace and then use 'coder.extrinsic' but i get error as mentioned above.
4 Kommentare
Walter Roberson
am 11 Mai 2015
I wasn't sure that objects were supported at all; I think there was a time they were not. After some searching I found that they are; see this page for supported features. Unfortunately I cannot look at the specific page for information about code generation for classes as I do not have the proper license to look at it.
Karthik
am 11 Mai 2015
Walter Roberson
am 12 Mai 2015
If you find that is not fast enough then you will need to use a MATLAB Function Block, which will go through Code Generation when you Build your model. coder.extrinsic is part of Code Generation. I think MATLAB Function Block was formerly called Embedded MATLAB Function Block but that changed a few years ago.
Karthik
am 4 Jun. 2015
Antworten (1)
Sebastian Castro
am 24 Jun. 2015
0 Stimmen
Since "ice" is already a variable visible inside that mask, you could create a parameter in the MATLAB Function block, as shown here:
- Sebastian
Kategorien
Mehr zu Simulink Coder finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!