Filter löschen
Filter löschen

How to generate C code for both .m file and simulink?

2 Ansichten (letzte 30 Tage)
Mayank
Mayank am 10 Mär. 2014
Beantwortet: Mike Hosea am 27 Mär. 2014
I have designed a control logic in Simulink which takes inputs from a matlab scrpit file. I want to convert this logic into C so that it can be subsequently flashed into an ECU. What is the way ahead? Please note that I have the 2008b version.

Antworten (1)

Mike Hosea
Mike Hosea am 27 Mär. 2014
It's hard to remember what all was supported in 2008b, and I'm also not a Simulink expert. What does your MATLAB script really do? If it's just defining input data, then that can be handled as a purely Simulink thing, and you can generate code from your model using Real-Time Workshop. If it's implementing some kind of algorithm and calling sim(), then what you probably want to do is generate a library for your Simulink model and then write a driver for it in C that implements what your script is doing and calls into that library. If the algorithm in your script is really complicated, you might want to use emlc (I think it was still "emlc" back then--now it's called "codegen") to generate code for it, but you'll have to do some work to use coder.ceval to call into your library.

Kategorien

Mehr zu Simulink Coder finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by