Main Content

meta.UnrestrictedDimension class

Package: meta
Superclasses: meta.ArrayDimension

Unrestricted dimension in property size specification

Description

The meta.Validation class Size property uses meta.UnrestrictedDimension objects to represent the use of a colon in a property size specification. An instance of this class in the Size array indicates that the respective dimension in the property definition is a colon. A colon in a size specification indicates that any values is allowed.

Attributes

Sealedtrue

For information on class attributes, see Class Attributes.

Examples

Find the fixed dimensions in a property validation.

The ValidationExample class specifies the size of the property value as (1,:).

classdef ValidationExample
   properties
      Prop (1,:) double {mustBeReal, mustBeGreaterThan(Prop, 10)} = 200;
   end
end

Read the dimensions into a cell array.

mc = ?ValidationExample;
mp = findobj(mc.PropertyList,'Name','Prop');
sz = mp.Validation.Size;
len = length(sz);
dim = cell(1:len);
for k = 1:len
   switch class(sz(k))
      case 'meta.FixedDimension'
         dim{k} = sz(k).Length;
      case 'meta.UnrestrictedDimension'
         dim{k} = ':';
   end
end
Introduced in R2018a