| Contents | Index |
| On this page… |
|---|
About Data Object Wizard User Packages Register Data Object Wizard User Packages Using sl_customization.m Data Object Wizard User Package Customization Using sl_customization.m |
Data Object Wizard (DOW) can be run in connection with a Simulink model to quickly determine which model data are not associated with data objects and to create and associate data objects with the data. (For more information about Data Object Wizard, see Data Object Wizard in the Simulink documentation and Create Simulink Data Objects with Data Object Wizard.) If you want the wizard to use data object classes from a package other than the standard Simulink class package to create the data objects, you select the package from the wizard's Choose package for selected data objects list. You can customize the package list by adding and removing packages and modifying the list order.
Note User-defined packages that you add to the list must contain a Simulink.Signal subclass named Signal and a Simulink.Parameter subclass named Parameter. |
To register Data Object Wizard user package customizations, use the Simulink customization file sl_customization.m. This file is a mechanism that allows you to use MATLAB code to perform customizations of the standard Simulink user interface. The Simulink software reads the sl_customization.m file, if present on the MATLAB path, when it starts and the customizations specified in the file are applied to the Simulink session. For more information on the sl_customization.m customization file, see Customizing the Simulink User Interface in the Simulink documentation.
To register Data Object Wizard user package customizations, you create an instance of sl_customization.m and include it on the MATLAB path of the Simulink installation that you want to customize. The sl_customization function accepts one argument: a handle to a customization manager object. For example,
function sl_customization(cm)
As a starting point for your customizations, the sl_customization function must first get the default (factory) customizations, using the following assignment statement:
hObj = cm.slDataObjectCustomizer;
You then invoke methods to register your customizations. The customization manager object includes the following methods for registering DOW user package customizations:
addUserPackage(hObj, packageName)
addUserPackage(hObj, cellArrayOfStrings)
Adds the specified user package(s) to the top of the package list, as displayed in the Choose package for selected data objects pull-down list in Data Object Wizard.
moveUserPackageToTop(hObj, packageName)
Moves the specified user package to the top of the package list, as displayed in the Choose package for selected data objects pull-down list in Data Object Wizard.
moveUserPackageToEnd(hObj, packageName)
Moves the specified user package to the end of the package list, as displayed in the Choose package for selected data objects pull-down list in Data Object Wizard.
removeUserPackage(hObj, packageName)
Removes the specified user package from the package list.
setUserPackages(hObj, cellArrayOfStrings)
Replaces the entire package list with a specified list of user packages.
Your instance of the sl_customization function should use these methods to register DOW user package customizations for your Simulink installation.
The Simulink software reads the sl_customization.m file when it starts. If you subsequently change the file, in order to use your changes, you must restart your Simulink session or enter the following command at the MATLAB command line:
sl_refresh_customizations
The sl_customization.m file shown in Example 5: sl_customization.m for DOW User Package Customizations uses the following methods:
addUserPackage to add the user packages ECoderDemos and SimulinkDemos (present by default in the MATLAB path) to the top of the package list, as displayed in the Choose package for selected data objects pull-down list in Data Object Wizard
moveUserPackageToEnd to move SimulinkDemos to the end of the package list
Example 5: sl_customization.m for DOW User Package Customizations
function sl_customization(cm)
% Register user customizations
% Get default (factory) customizations
hObj = cm.slDataObjectCustomizer;
% Add user packages
hObj.addUserPackage({'ECoderDemos', 'SimulinkDemos'});
% Move SimulinkDemos to end of list
hObj.moveUserPackageToEnd('SimulinkDemos');
endIf you include the above file on the MATLAB path of the Simulink installation that you want to customize, the specified customizations will appear in Data Object Wizard. For example, you could view the customizations as follows:
Start a MATLAB session.
Launch a model, such as rtwdemo_udt.
Open Data Object Wizard, for example, by selecting Tools > Data Object Wizard in the Simulink window.
In the Data Object Wizard dialog box, click the Find button to generate a list of one or more data objects.
Examine the Choose package for selected data objects drop-down list, noting the impact of the changes specified in Example 5: sl_customization.m for DOW User Package Customizations.

To replace the entire Data Object Wizard package list with a specified list of user packages, you can use a method invocation similar to the following:
hObj.setUserPackages({'myPackage1', 'ECoderDemos', 'mpt'});
![]() | Custom Storage Classes | Function and Class Interfaces | ![]() |

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