Is there any good video and documentation to convert from Simulink to C and C++ code

1 view (last 30 days)
Hello,
Could you please let me know if there any good video and documentation to convert from Simulink to C and C++?
I have a simulink model but it does not convert successfully to C and to C++ with many issues sso what is the best way to learn and troubleshoot the issues?'
Thanks,
Charles

Answers (2)

Sreelakshmi S.B
Sreelakshmi S.B on 8 May 2019
Documentation on how to Generate C code from a Simulink model : https://in.mathworks.com/help/dsp/ug/generate-c-code-from-simulink-model.html

Charles Nguyen
Charles Nguyen on 8 May 2019
Hello,
I also found out 2 more options from Simulink
you can right click on the "subystem" that you want to generate c or c++ i.e. with 2 options listed below
Option 1:
"c/c++" --> "embedded code quick start" and generate the models by answer a few question. However, it gave difffererent errors compared to the link you sent where you have to go the "Simulation" " --->"Mode' Configuration Parameters"
Option 2:
"c/c++" --> "build this subsystems". I am able to get the C code generation with out errors. (Only C code generated) (I noted that there are NOT a lot of questions asked.
My questions are:
  1. Why Options 2 only generate C code only? How can I use Option 2 to generate C++ code?
  2. Should I trust the C code generation from this Option 2?
  3. Option 1 give errors for C or C++ vs. Option 2 give me no errors for code C generation
  4. Your suggestion from the link you sent i.e. from going to the "Simulation" " --->"Mode' Configuration Parameters" and select the require options for either C or C++. These provide different issues/errors compared to Option 1.
  5. Why are there 3 different options for code generation and each option has different issues with no outputs provided except where Option 2 works (C code only).
  6. So what option should we be choosing i.e. Your provided link Option, or Option 1, or Option 2? (Note Option 2 only works with C code only and why we cannot select C++ from this Option 2.
Thank you,
Charles

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!