I want to call M File In SIMULINK Model. I take one x constant , One Matlab Fnc , Matlab Fnc Output to display .
I want to x value as input in M file function and their output display in y varibale.
How can i do it ?

댓글 수: 1

charmingtilak
charmingtilak 2017년 9월 19일
i have to import large data in .mat file to To file function block.. kindly assist me |

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

 채택된 답변

Rajiv Ghosh-Roy
Rajiv Ghosh-Roy 2014년 9월 18일

1 개 추천

You can use the Interpreted MATLAB function block for this; it can be found under the User defined functions category in the Simulink library browser.

댓글 수: 3

hardik
hardik 2014년 9월 18일
I take it Interpreted MATLAB function block , but how to call m file
hardik
hardik 2014년 9월 18일
Here I attached both file
huan zhang
huan zhang 2019년 6월 14일
did you solve the question and call a m file successfully in simulink?

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

추가 답변 (2개)

Shravankumar P
Shravankumar P 2014년 9월 18일

3 개 추천

Open your simulink library
1) Select simulink in the tree view. 2) Simulink/user-defined functions/MATLAB Function 3) open a new model and place MATLAB function block in it,then double click on it 4) now write your function
function y = fcn(x)
%#codegen
y = x^2;

댓글 수: 2

hardik
hardik 2014년 9월 18일
I got these error
Unable to locate a C-compiler required by Stateflow and MATLAB Function blocks. Use 'mex -setup' to select a supported C-compiler.
Abdullah Alshammary
Abdullah Alshammary 2016년 4월 18일
then take this line out: %#codegen It is meant for mex to generate c code for it. Apparently you don't have mex but that's fine.

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

atef
atef 2016년 9월 5일

0 개 추천

Use the Interpreted MAT-LAB function block .... MATLAB function: TestFun(u) and it will call m file: TestFun.m
function kp = TestFun(i) kp = i*10; disp(kp); end

댓글 수: 2

ABISHA  P
ABISHA P 2017년 1월 11일
how to call .m file in simulink model for performing filtering operations like sliding window , savtzky golay filter , spectrogram generation, these operations are done in m file same thing has to be called in simulink ? How can i do it?
nima nabavi
nima nabavi 2020년 9월 2일
Thank you dear.

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

카테고리

도움말 센터File Exchange에서 Event Functions에 대해 자세히 알아보기

질문:

2014년 9월 18일

댓글:

2020년 9월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by