addproperty - Add custom property to COM object

Syntax

h.addproperty('propertyname')
addproperty(h, 'propertyname')

Description

h.addproperty('propertyname') adds the custom property specified in the string, propertyname, to the object or interface, h. Use set to assign a value to the property.

addproperty(h, 'propertyname') is an alternate syntax for the same operation.

Remarks

COM functions are available on Microsoft Windows systems only.

Examples

Create an mwsamp control and display its properties:

f = figure('position', [100 200 200 200]);
h = actxcontrol('mwsamp.mwsampctrl.2', [0 0 200 200], f);
h.get

MATLAB software displays:

     Label: 'Label'
    Radius: 20

Add a new property named Position to the control. Assign an array value to the property:

h.addproperty('Position');
h.Position = [200 120];
h.get

MATLAB displays (in part):

       Label: 'Label'
      Radius: 20
    Position: [200 120]

Delete the custom Position property:

h.deleteproperty('Position');
h.get

MATLAB displays:

     Label: 'Label'
    Radius: 20

Create an mwsamp control and add a new property named Position to it. Assign an array value to the property:

f = figure('position', [100 200 200 200]);
h = actxcontrol('mwsamp.mwsampctrl.2', [0 0 200 200], f);
h.get
     Label: 'Label'
    Radius: 20

h.addproperty('Position');
h.Position = [200 120];
h.get
     Label: 'Label'
    Radius: 20
  Position: [200 120]

h.get('Position')
ans =
   200   120

Delete the custom Position property:

h.deleteproperty('Position');
h.get
     Label: 'Label'
    Radius: 20

See Also

deleteproperty, get (COM), set (COM), inspect

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS