In class definition before MATLAB® 7.6 (classes defined without a classdef
statement), class constructors called the
class
function to create the object. The following
class
function syntaxes apply only within classes defined
before Version 7.6.
obj = class(s,ClassName)
creates an array of objects of the
specified class using the struct
s
as a pattern to determine the size of obj
.
obj = class(s,ClassName,parent1,parent2,...)
inherits the
methods and fields of the specified parent objects. The size of the parent objects
must match the size of s
or be a scalar (1-by-1). If they are
scalar, MATLAB performs scalar expansion.
obj = class(struct([]),ClassName,parent1,parent2,...)
constructs an object containing only fields that it inherits from the parent
objects. All parents must have the same nonzero size, which determines the size of
the returned object.
objStruct = class(structArray,ClassName,parentArray)
maps every
element of the parentArray
to a corresponding element in the
structArray
to produce the output array of objects,
objStruct
.
All arrays must be of the same size. If either the structArray
or the parentArray
is of size 1-by-1, then MATLAB performs scalar expansion to match the array sizes.
To create an object array of size 0-by-0, set the size of the
structArray
and parentArray
to
0-by-0.