Borrar filtros
Borrar filtros

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

2 visualizaciones (últimos 30 días)
Gene
Gene el 25 de Oct. de 2012
Respondida: Ben Salem Youssef el 5 de Jul. de 2017
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

Respuestas (2)

Kaustubha Govind
Kaustubha Govind el 26 de Oct. de 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 el 5 de Jul. de 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

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by