Using Simulink Previous page   Next Page

Creating Persistent Data Objects

To create parameter and signal objects that persist across Simulink sessions, first write a script that creates the objects or create the objects with the Simulink Data Explorer (see Subclassing Simulink Data Classes) or at the command line and save them in a MAT-file (see Saving and Loading Data Objects). Then use either the script or a load command as the PreLoadFcn callback routine for the model that uses the objects. For example, suppose you save the data objects in a file named data_objects.mat and the model to which they apply is open and active. Then, entering the following command

at the MATLAB command line sets load data_objects as the model's preload function. This in turn causes the data objects to be loaded into the model workspace whenever you open the model.


Previous page  Working with Data Objects Subclassing Simulink Data Classes Next page

© 1994-2005 The MathWorks, Inc.