Generic C code generation with Simulink

1 Ansicht (letzte 30 Tage)
Alvins
Alvins am 23 Feb. 2015
Beantwortet: Jatin am 2 Sep. 2024
I would like to generate generic C code from a ‘MATLAB Function’ block.
How could I change input files parameters (size, type) without loading any sources files ?
Does Simulink code generation work like MATLAB Coder ? (especially for C/C++ Dynamic Library).

Antworten (1)

Jatin
Jatin am 2 Sep. 2024
Hi Alvins,
As per my understanding, you are trying to generate C code from Simulink model which involves ‘MATLAB function’ block, and you want to change the size and type of the input parameters without modifying the source file.
To change the input parameters without modifying source files, you can follow this:
  1. Define parameters in the MATLAB workspace and reference them using the “Model Explorer, you can also change types and size of existing parameters.
  2. In the configuration property window, use ‘tunable’ parameters, which allows you to change the values without altering source code.
Simulink Coder works almost like MATLAB coder just that it has been optimized to generate code from Simulink models, Simulink coder is often used to generate code for embedded systems, regarding dynamic libraries you can configure the build settings to output a dynamic library by using the ‘Interface’ tab under ‘code generation’.
Kindly refer to the documentations below for more information.
Model Explorer:
Generate C Code by Using Simulink Coder Quick Start Tool:
Hope this helps!

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