What's the difference between MATLAB function block and Interpreted MATLAB function block?

조회 수: 73 (최근 30일)
Hi, I'm studying MATLAB function Block and I have some questions.
There is another Block in User-Defined Block Library, Interpreted MATLAB function block. Maybe it is similar to MATLAB function block. But I can't fine the apparent difference. Everything's Okay to both blocks. (Maybe it is due to my function is simple.)
Is there any good reason to realize another('interpreted') MATLAB function block?

채택된 답변

Sebastian Castro
Sebastian Castro 2015년 7월 3일
The MATLAB Function block is compiled before run-time (R2014b and earlier, it generates C code and compiles; R2015a and later, it is compiled just-in time). The Interpreted MATLAB Function block uses the MATLAB interpreter to execute an existing MATLAB function.
So, what does this mean? If you're just running simulations on your desktop, not much. This is likely why you do not see any difference. However, if you're generating code from your model, you cannot do so with the Interpreted MATLAB Function block.
Also, the MATLAB Function block is a lot more customizable, as you have more control over the properties (size/data type/data scope) of all the variables, you can create tunable parameters in the blocks, etc.
In summary, the MATLAB Function block is way more flexible and I would recommend using it in most situations. The Interpreted MATLAB Function block can be easier to set up if you have already have an existing function, and it lets you use the full range of MATLAB as long as you're using the model strictly for desktop simulation.
- Sebastian
  댓글 수: 1
JangHo Cho
JangHo Cho 2015년 7월 3일
Thank you Mr. Castro. I understand. 'compiled before run-time' is the difference. I should use MATLAB function block. then. :)

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

추가 답변 (1개)

Navid Mohammadzadeh
Navid Mohammadzadeh 2017년 11월 15일
Hello. I shared with you a picture which tells you about the difference between different function block in MATLAB. I hope you enjoy it. You can find it also in the MathWork.

카테고리

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