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

2 次查看(过去 30 天)
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.

回答(1 个)

Mike Hosea
Mike Hosea 2014-3-27
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.

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by