Products & Services Solutions Academia Support User Community Company

Learn more about Real-Time Workshop Embedded Coder   

Customizing Data Object Wizard User Packages

Introduction

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 Creating 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. This package list can be customized in various ways, including adding or removing packages and modifying the list order.

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 M-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.

Registering Data Object Wizard User Packages Using sl_customization.m

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:

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, you must restart your Simulink session or enter the following command at the MATLAB command line to effect the changes:

sl_refresh_customizations

Example Data Object Wizard User Package Customization Using sl_customization.m

The sl_customization.m file shown in Example 5: sl_customization.m for DOW User Package Customizations uses the following methods:

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');

end

If 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:

  1. Start a MATLAB session.

  2. Launch a model, such as rtwdemo_udt.

  3. Open Data Object Wizard, for example, by selecting Tools > Data Object Wizard in the Simulink window.

  4. In the Data Object Wizard dialog box, click the Find button to generate a list of one or more data objects.

  5. 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'});
  


Related Products & Applications

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