C/C++ code generation features for Simulink models are only available if you have the following products installed and licensed:
- MATLAB Coder
- Simulink Coder
- Embedded Coder (optional)
NOTE: Embedded Coder is required if you use its features, or if your system target file is based on ert.tlc rather than grt.tlc. For MathWorks products, see our Product Requirements. For third-party targets or tools, check with the vendor or see our Third-Party Products page.
Please try out the following 5 troubleshooting steps if you encounter one of the symptoms above:
1. Check Licensing:
Check out the licenses by running the following commands in MATLAB:
>> [status,errmsg] = license('checkout','matlab_coder')
>> [status,errmsg] = license('checkout','real-time_workshop')
>> [status,errmsg] = license('checkout','RTW_Embedded_Coder')
Each command should return 'status = 1' and "errmsg = 0×0 empty char array" if the license checkout is successful.
Note that Embedded Coder is an extension of Simulink Coder. This means that Embedded Coder only works with Simulink models when Simulink Coder is also installed and licensed. Simulink Coder itself always requires MATLAB Coder.
2. Check product installation:
Execute the following command to get the full list of installed products and associated licenses per product:
Check that MATLAB Coder and Simulink Coder are listed (and Embedded Coder if applicable).
If a product is missing from the above list, then add MATLAB Coder and Simulink Coder (and Embedded Coder if applicable) toolboxes to your existing installation as shown in the following link:
3. Try restarting MATLAB and your PC:
Restarting MATLAB and/or your PC may resolve the issue, especially if a MathWorks-related product was recently installed or updated.
4. Check if the Code Generation option is present for a shipped model:
Open the following model:
and check for the Code Generation option in Model Configuration Parameters (CTRL+E).
If the code generation options are available for the shipped model:
a. Check if the model without the options has any issues in the Upgrade Advisor.
b. Try to re-create the model in a fresh file by copying and pasting all blocks.
If the code generation options are available for the shipped model and the issue persists for your model after the above checks, contact MathWorks Technical Support.
5. Restore your MATLAB path and cache:
Restore your MATLAB path and toolbox cache as explained in the following article: