필터 지우기
필터 지우기

How can I run a simple Matlab .m file from Simulink

조회 수: 2 (최근 30일)
Gene
Gene 2012년 10월 25일
답변: Ben Salem Youssef 2017년 7월 5일
I want to run a simple .m file from Simulink but keep getting the following error:
Message Source Reported by Summary Code Error Unknown Stateflow Unable to locate a C-compiler required ...
I'm using the "Matlab Function" block from the Simulink "User-defined Functions" library. I copied a .m file from a working matlab .m file into the "Matlab Function" block. The .m file is straight Matlab code with nothing fancy going on. I found a matlab video tutorial where they do roughly the same thing with no mention of C-compiler.
I'm not trying to generate compiled code or code for an embedded processor. Is there some switch I need to set to let Simulink know I just want it treat the function as plain old matlab code?
Thanks

답변 (2개)

Kaustubha Govind
Kaustubha Govind 2012년 10월 26일
The MATLAB Function block always runs in "accelerated" mode, which means that it generates C code from your MATLAB code, compiles it into a MEX-function and runs using that files. The need to setu[ a compiler is described in the documentation, but perhaps it was overlooked in the video tutorial. If you simply want to run your MATLAB code using the interpreter, you can use the Interpreted MATLAB Function block, but you are limited to a single-input, single-output function. A slightly more advanced way to call the MATLAB interpreter is using MATLAB S-functions, but if you can make do with the limitations of the Interpreted MATLAB Function block, then that is easier to use.

Ben Salem Youssef
Ben Salem Youssef 2017년 7월 5일
Unable to locate a C-compiler required by Stateflow and MATLAB Function blocks. Use 'mex -setup' to select a supported C-compiler.
Who has an idea for this error message. I need answers. I would be very grateful

카테고리

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