Main Content

load

Class: Simulink.dialog.MaskPartReference
Namespace: Simulink.dialog

Load XML file in mask part reference container

Since R2024b

Syntax

maskPartRefObj.load

Description

maskPartRefObj.load loads the XML file in a mask part reference container. maskPartRefObj stores the parameters and dialog controls. The XML file is specified in the FileName property of maskPartRefObj.

The mask part reference object is created by adding the mask part reference container using the mask object. The mask part reference container in the Mask Editor helps to create and save parameters and dialog controls in an XML file. These saved parameters and dialog controls are referred to and reused across multiple masked blocks.

Examples

expand all

Load the model.

model = "slexMaskingBasic.slx";
load_system(model);

Get the mask object and add mask part reference container to it.

maskObj = Simulink.Mask.get("slexMaskingBasic/mx + b");
maskPartRefObj = maskObj.addDialogControl(Type='maskpartreference',Name='MaskPartRefContainer')
maskPartRefObj = 
  MaskPartReference with properties:

              Name: 'MaskPartRefContainer'
          FileName: ''
    InstanceValues: {0x1 cell}
               Row: 'new'
           Enabled: 'on'
           Visible: 'on'
      AlignPrompts: 'off'
    DialogControls: [0x0 Simulink.dialog.Control]
           Tooltip: ''

Specify the XML file containing mask parameters and dialog controls.

maskPartRefObj.FileName = 'main_mask_part_ref';

Load the contents of the XML file into the mask part reference container and observe that there are four dialog controls available in the mask part reference object.

maskPartRefObj.load
maskPartRefObj
maskPartRefObj = 
  MaskPartReference with properties:

              Name: 'MaskPartRefContainer'
          FileName: 'main_mask_part_ref'
    InstanceValues: {0x1 cell}
               Row: 'new'
           Enabled: 'on'
           Visible: 'on'
      AlignPrompts: 'off'
    DialogControls: [1x4 Simulink.dialog.Control]
           Tooltip: ''

Alternatives

Use the Mask Editor UI to load the mask part reference XML file.

Version History

Introduced in R2024b