Main Content

gobjects

Initialize array for graphics objects

Description

H= gobjects(n)returns ann-by-ngraphics object array. Use thegobjectsfunction instead of theonesorzerosfunctions to preallocate an array to store graphics objects.

example

H= gobjects(s1,...,sn)returns ans1-by-...-by-sngraphics object array, where the list of integerss1,...,sndefines the dimensions of the array. For example,gobjects(2,3)returns a 2-by-3 array.

example

H= gobjects(v)returns a graphics object array where the elements of the row vector,v, define the dimensions of the array. For example,gobjects([2,3,4])returns a 2-by-3-by-4 array.

H= gobjectsreturns a 1-by-1 graphics object array.

example

H= gobjects(0)returns an empty graphics object array.

Examples

collapse all

Preallocate a 4-by-1 array to store graphics handles.

H = gobjects(4,1)
H = 4x1 GraphicsPlaceholder array: GraphicsPlaceholder GraphicsPlaceholder GraphicsPlaceholder GraphicsPlaceholder

Create an array to store graphics handles using the size of an existing array.

DefineAas a 3-by-4 array.

a = [1,2,3,2;4,5,6,6;7,8,9,7];

Create an array of graphics handles using the size ofA.

v = size(A); H = gobjects(v);

The dimensions of the graphics handle array are the same as the dimensions ofA.

isequal(size(H),size(A))
ans =logical1

Use thegobjectsfunction to return an empty array.

H = gobjects(0)
H = 0x0 empty GraphicsPlaceholder array.

Input Arguments

collapse all

Size of the object array, specified as an integer value. Negative integers are treated as 0. The array has dimensionsn-by-n.

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Size of each array dimension, specified as a list of two or more integer values. Negative integers are treated as 0.

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Size of each array dimension, specified as a row vector of integer values. Negative integers are treated as 0.

Example:[2,4,6,7]

Data Types:single|double|int8|int16|int32|int64|uint8|uint16|uint32|uint64

Define an empty array by specifying one or more dimension equal to0

Output Arguments

collapse all

Initialized graphics object array of typeGraphicsPlaceholder. Use this array to contain any type of graphics object.

See Also

Introduced in R2013a