MATLAB Object-Oriented Programming

(Joyce) #1

cubic
spline
end
end


Change the Interp property validation to use the InterpMethod class.


classdef ValidatorFunction
properties
Data {mustBeNumeric, mustBeFinite}
Interp InterpMethod
end
end


Assign a value matching the first few letters of 'cubic'.


a = ValidatorFunction;
a.Interp = 'cu'


a =


ValidatorFunction with properties:


Data: []
Interp: cubic


MATLAB Validation Functions


MATLAB defines functions for use in property validation. These functions support
common use patterns for property validation and provide descriptive error messages. This
table lists the MATLAB validation functions, their meanings, and the MATLAB functions
used by the validation functions.


Name Meaning Dependencies
mustBePositive(A) A > 0 gt, isreal,
isnumeric,
islogical
mustBeNonpositive(A) A <= 0 ge, isreal,
isnumeric,
islogical

Property Validation Functions
Free download pdf