Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
Gene
Gene le 25 Oct 2012
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

Réponses (2)

Kaustubha Govind
Kaustubha Govind le 26 Oct 2012
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 le 5 Juil 2017
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

Catégories

En savoir plus sur Simulink Functions dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by