| Using Simulink | ![]() |
Building Simulation Targets
A simulation target is an S-function that computes the outputs of a referenced model during simulation of the model's parent. You can command Simulink to generate simulation targets for model references at any time by updating the model's diagram or by executing the slbuild command at the MATLAB command line or you can let Simulink determine whether and when to build the simulation targets. If the simulation target for a referenced model does not exist at the start of a simulation, Simulink generates the target. Subsequently, if the files or workspace variables used to build the target change, it may be necessary to rebuild the target to reflect the changes, depending on whether the changes affect target outputs. You can let Simulink determine whether to rebuild existing targets or specify that Simulink always or never rebuild targets at the beginning of a simulation (see Rebuild options for all referenced models).
While generating a target, Simulink displays status messages at the MATLAB command line to enable you to monitor the target generation process, which entails generating and compiling code and linking the compiled target code with compiled code from standard code libraries to create an executable file.
Simulink creates simulation targets in the current working directory. It stores intermediate files used to generate the simulation targets in separate subdirectories of a subdirectory of the working directory named slprj. If the slprj directory does not exist, Simulink creates it. The Simulink Accelerator and Real-Time Workshop also use the slprj subdirectory of the current working directory to store intermediate files used to build acceleration targets and stand-alone targets, respectively.
Project Directories
The policy of having all Simulink-related products store generated files in the same subdirectory of the current work directory makes it easy for you to keep all the generated files for a given project together and separate from generated files belonging to other projects. All that is required is that you create a separate directory for each project and make the directory for a given project the current working directory when you are working on the project.
Converting Subsystems to Model References
Converting an existing model to use model referencing can be a time-consuming and error-prone task if done by hand. Execute
at the MATLAB command line for a demonstration of a way to automate this task.
| Model Interfaces | Modeling with Control Flow Blocks | ![]() |
© 1994-2005 The MathWorks, Inc.