How can I run a simple Matlab .m file from Simulink
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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
0 Commenti
Risposte (2)
Kaustubha Govind
il 26 Ott 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.
0 Commenti
Ben Salem Youssef
il 5 Lug 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
0 Commenti
Vedere anche
Categorie
Scopri di più su Simulink Functions in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!