Azzera filtri
Azzera filtri

rtwbuild doesn't generate modelsources.txt in MATLAB 2023

6 visualizzazioni (ultimi 30 giorni)
I have used rtwbuild in MATLAB 2020a and it generated modelsources.txt.
MATLAB 2023a doesn't generate this file. Please help me to solve it.
  2 Commenti
Shivam Gothi
Shivam Gothi il 23 Ago 2024
Modificato: Shivam Gothi il 23 Ago 2024
Hello,
Can you please share the screenshot of the error message?
or elaborate the issue
Trung Nguyen Thanh
Trung Nguyen Thanh il 26 Ago 2024
Modificato: Trung Nguyen Thanh il 27 Ago 2024
This is the difference in rtwbuild between MATLAB 2020a and MATLAB 2023a:
2020a:
2023a:
In MATLAB 2023a, after rtwbuild function, it does not generate file modelsources.txt which contains subsystem_name.c

Accedi per commentare.

Risposta accettata

Shivam Gothi
Shivam Gothi il 26 Ago 2024
Hello,
I took a simulink model and generated the code for them in R2020a and R2023a version. The "modelsources.txt" was present in R2020a version, but not in R2023a. But, the rest of the files were present in both of them. Basically, the "modelsources.txt" file only contains the name of simulink model. May be, with the newer version of MATLAB, the "modelsources.txt" file is not created by the compiler because it is redundant.
Therefore, it cannot be called an error / issue.
  1 Commento
Trung Nguyen Thanh
Trung Nguyen Thanh il 27 Ago 2024
Modificato: Trung Nguyen Thanh il 27 Ago 2024
Ok, So this is normal for matlab 2023a.
Thank you for your dedicated support.

Accedi per commentare.

Più risposte (1)

Shivam Gothi
Shivam Gothi il 26 Ago 2024
Modificato: Shivam Gothi il 26 Ago 2024
Hello Trung Nguyen Thanh,
I understand that you are trying to generate the code for Simulink model in MATLAB version R2023a, using “rtwbuild”. The code was generated in MATLAB 2020a version, but it is having some issue with MATLAB R2023a version.
I have tried to generate a c-code in R2023a, for a Simulink model, and it compiled without any error.
Here are the steps which can help you to generate a c code for your Simulink model (R2023a):
Step1 : Make a valid Simulink model in R2023a, run the simulation and save it to the location that is in the search path of MATLAB. To see the search path of MATLAB, go to MATLAB command window and type the command “path”. The first path appearing in the list will be the current working folder. Save your Simulink model in that folder.
Step-2: Configure the model properties.
  • Open the “Configuration parameters “. It is found under the “Modelling” tab of Simulink window.
  • Under “Configuration parameters” select the “Solver” options and make the following changes as shown in below figure.
NOTE : The solver must be configured for “fixed step size”. The sample time can vary according to the application. Here, I have selected it as 1e-8.
Step 3: Now navigate to the “Code Generation” tab under “Configuration parameters” and make the following changes as shown below:
NOTE : You must have a tool chain installed for code generation to work. Follow the below steps to install a tool chain.
  • Go to “Add-on” options under “Home” tab in MATLAB window. Search for “MATLAB Support for MinGW-w64 C/C++/Fortran Compiler” in the search bar of “ADD-ON Explorer”. As shown in below image.
  • Click “install”.
Step 4 : Now go to the MATLAB command window and type the “rtwbuild” command, with the Simulink model name. A sample code below illustrates this.
modelName = 'fault_creation2';
rtwbuild(modelName);
NOTE : (Here the name of Simulink model is “fault_creation2.slx”);
The code generation will start and you will see the status messages in command window. Once the build has completed, you will be able to see a separate folder created in the current working folder. The conventional naming of folder will be:
filename_grt_rtw”. This folder contains the header and the source files for a modular c-code.
Plaese refer to the following MATLAB documentation links:
I hope this resolves the issue.
  4 Commenti
Trung Nguyen Thanh
Trung Nguyen Thanh il 26 Ago 2024
Modificato: Trung Nguyen Thanh il 26 Ago 2024
modelsources.txt file contains subsystem_name.c
Shivam Gothi
Shivam Gothi il 26 Ago 2024
What "system target file" you are using? I am using rsim.tlc as shown in below image.
May be, that might be causing difference.
Tell me your "system target file", I will also build the model using the same...

Accedi per commentare.

Categorie

Scopri di più su Simulink Coder in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by