Main Content

validatePropertiesImpl

Class: matlab.System

Validate property values of System object

Syntax

validatePropertiesImpl(obj)

Description

validatePropertiesImpl(obj) validates interdependent or interrelated property values the first time the System object™ runs.

Run-Time Details

validatePropertiesImpl is called by setup when the object is run for the first time and when any tunable property changes. For details, see Detailed Call Sequence.

Method Authoring Tips

  • You must set Access = protected for this method.

  • You cannot modify any properties in this method. Use the processTunedPropertiesImpl method or setupImpl method to modify properties.

  • To check if a property has changed since stepImpl was last called, use isChangedProperty(obj,property) within validatePropertiesImpl.

Input Arguments

expand all

System object handle used to access properties, states, and methods specific to the object. If your validatePropertiesImpl method does not use the object, you can replace this input with ~.

Examples

expand all

To validate the value of increment, validate that the useIncrement property is true and that the value of the increment property is greater than zero.

methods (Access = protected)
   function validatePropertiesImpl(obj)
       if obj.useIncrement && obj.increment < 0
          error('The increment value must be positive');
       end
    end
end

Alternative Functionality

If your property does not depend on any other property, you can use MATLAB class property validators at the property definition. For more information, see Validate Property and Input Values.

Introduced in R2012a