| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Real-Time Workshop |
| Contents | Index |
| Learn more about Real-Time Workshop |
The following example uses a System Start Function block to introduce code into the MdlStart function. The next figure shows a simple model with the System Start Function block inserted.

Double-clicking the System Start Function block opens the System Start Function Custom Code dialog box.

You can insert custom code into any or all of the available text fields.
The code below is the MdlStart function for this example (mymodel).
void MdlStart(void)
{
{
{
/* user code (Start function Header) */
/* System '<Root>' */
unsigned int *ptr = 0xFFEE;
/* user code (Start function Body) */
/* System '<Root>' */
/* Initialize hardware */
*ptr = 0;
}
}
MdlInitialize();
}
The custom code entered in the System Start Function Custom Code dialog box is embedded directly in the generated code. Each block of custom code is tagged with a comment such as
/* user code (Start function Header) */
![]() | Custom Code Library | Custom Code in Subsystems | ![]() |

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 |