Skip to Main Content Skip to Search
Product Documentation

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 the COM set function to assign a value to the property.

addproperty(h,'propertyname') is an alternate syntax.

COM functions are available on Microsoft Windows systems only.

Examples

Add a custom property to an instance of the MATLAB sample control:

  1. Create an instance of the control:

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

    MATLAB displays its properties:

         Label: 'Label'
        Radius: 20
    
  2. Add a custom property named Position and assign a value:

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

    MATLAB displays (in part):

           Label: 'Label'
          Radius: 20
        Position: [200 120]
  3. Delete the custom property Position:

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

    MATLAB displays the original list of properties:

         Label: 'Label'
        Radius: 20

See Also

deleteproperty | get (COM) | inspect | set (COM)

How To

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS