Clear Filters
Clear Filters

Can't find main.c file when using SIMULINK code generation

8 views (last 30 days)
If i try to generate code for my model using Simulink code gen. The only files that come are model.c files and other files. However, I am always missing the ,"main.c" file. How do I get that file?

Answers (1)

Vinayak Choyyan
Vinayak Choyyan on 13 Apr 2023
Hi Rahul,
As per my understanding, you are trying to generate C code using Simulink Coder and wish to know why the main file is missing.
Simulink Coder generates code for real-time and nonreal-time applications, including simulation acceleration, rapid prototyping, and hardware-in-the-loop testing. In these types of systems, the main function is typically provided by the target operating system or runtime environment, and the generated code is integrated with the system through other means. On the other hand, Embedded Coder is specifically designed to generate code for microcontrollers and other embedded systems that may not have an operating system or runtime environment. Therefore, when generating code using Embedded Coder, there is an option to "Generate a default main function".
Depending on your use case, consider using Embedded Coder to get the main file.
I hope this resolves the issue you are facing.


Find more on Simulink Coder in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!