gobjects
Creates an array of placeholder graphics objects for preallocation.
Category: Graphics > Graphics Objects
Syntax
G = gobjects(n)
Creates an n-by-n array of placeholders.
G = gobjects(sz1, ..., szN)
Creates an array of the given size.
Description
Preallocating a handle array before a loop avoids growing it element by element, and gives it the right class for graphics handles. Each element is an empty placeholder until you assign a handle to it.
Input arguments
n, sz1, ..., szN- Non-negative integer sizes.
Output arguments
G- Array of
GraphicsPlaceholderobjects, later replaced with real handles.
Example
Preallocate handles
G = gobjects(2, 1);
disp(class(G))
disp(size(G))
Output
matlab.graphics.GraphicsPlaceholder
2 1