| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Real-Time Workshop Embedded Coder |
| Contents | Index |
| Learn more about Real-Time Workshop Embedded Coder |
The previous procedure placed all of the model's data objects in the model source file. Now you place all of the global data objects in a file separate from the model source file:
Configure the model's generated code to include all Simulink data objects (signal and parameter) in a separate definition file. Set Diagnostics > Data Validity > Signal resolution to Explicit and implicit.
Specify that data be defined in a separate file. Set Real-Time Workshop > Data Placement > Data definition to Data defined in single separate source file. . Accept the default for Data definition filename, global.c

Specify that data be declared in a separate file. Set Data declaration to Data declared in a single separate header file and accept the default for Data declaration filename, global.h. Then, click Apply.
Click Generate code. Notice that the code generation report lists global.c and global.h files.
Inspect the code generation report. Notice that
The data objects formerly initialized in rtwdemo_mpf.c now are initialized in global.c.
The file rtwdemo_mpf.c includes rtwdemo_mpf.h.
The file rtwdemo_mpf.h includes global.h.
![]() | Creating a Data Dictionary for a Model | Defining a Specific Global Data Object in Its Own File | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |