How can matlab coder be configured to generate only one c file?

37 次查看(过去 30 天)
My problem is this: similarly, I can generate only one model.c and model.h file in simulink coder by setting the "File packaging format" to "compact". and model.h files, but if I don't use simulink coder, how can I generate only one c file/header file for my algorithm via Matlab coder app or command line control in this way? Thanks in advance
simlar issue:
------------------------------
Update to clarify:
I mean actually generate only one ".c" and the corresponding ".h" file, not Instead of following the steps below, select "Generate all functions into a single file". Because this generates additional files, such as <name>_type.h, etc.
Using the MATLAB Coder App
  1. To open the Generate dialog box, on the Generate Code page, click the Generate arrow .
  2. Click More Settings.
  3. On the Code Appearance tab, set the Generated file partitioning method to Generate one file for each MATLAB file or Generate all functions into a single file.

回答(1 个)

Denis Gurchenkov
Denis Gurchenkov 2022-3-11
编辑:Denis Gurchenkov 2022-3-11
Yes you can tell MATLAB Coder to generate a single file. Here is the doc page.
  5 个评论
cui,xingxing
cui,xingxing 2022-9-16
编辑:cui,xingxing 2022-9-16
Unfortunately I don't see this enhancement in the new version R2022b which has just been released. Personally I don't see a technical problem with this new feature, the simulink coder/embeded coder can generate the model as a separate .h and .cpp file. I wonder if matlab coder will be introduced with any importance in R2023a?
Reference
Amalgamate,A cross platform command line tool for producing an amalgamation of C or C++ sources.

请先登录,再进行评论。

类别

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

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by