필터 지우기
필터 지우기

Is it possible to select an m-file for a "MATLAB function" block in Simulink?

조회 수: 30 (최근 30일)
Francesco
Francesco 2016년 3월 31일
답변: Walter Roberson 2019년 9월 18일
I have a number of functions saved as M-file and want to use them in a Simulink model as "MATLAB function" blocks. What options do I have, more than copy and paste? Can I load the M-files in such blocks by just selecting the files in a dialog box, for instance?
Thanks

답변 (2개)

Walter Roberson
Walter Roberson 2019년 9월 18일
No, you cannot load files into MATLAB Function Block.
You can use the MATLAB Function Block as a very thin wrapper that just calls your function by name (you might have to initialize output variables as well)

Orion
Orion 2016년 3월 31일
Hi,
You can use the Interpreted Matlab Function Block (not the same as Matlab function).
For example
But just be aware that this block only accepts one input and one output. So if you have multiple I/O, you need to mux/demux them as I did on this demo.
The advantage of this block is that all Matlab functions are supported, that's not the case for the Matlab Function block you used.

카테고리

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