필터 지우기
필터 지우기

How to use object instances in embedded matlab function

조회 수: 1 (최근 30일)
Karthik
Karthik 2015년 5월 11일
답변: Sebastian Castro 2015년 6월 24일
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
Walter Roberson
Walter Roberson 2015년 5월 12일
Perhaps if you build a Level-2 S function; see here
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
Karthik 2015년 6월 4일
I didn't have time to try with S-function but for now i have created a workaround and have avoided using embedded Matlab function block (EMFB). But the problem of using object in EMFB still persists.
I also tried making 'ice' global and call global ice in EMFB. But, to call a global variable into EMFB, i need either data store block or simulink.signal object defined. Both doesn't seem to work in my case because i am not able to define a data type.

댓글을 달려면 로그인하십시오.

답변 (1개)

Sebastian Castro
Sebastian Castro 2015년 6월 24일
Since "ice" is already a variable visible inside that mask, you could create a parameter in the MATLAB Function block, as shown here:
- Sebastian

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by