필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
Mayank
Mayank 2014년 3월 10일
답변: Mike Hosea 2014년 3월 27일
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