Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

Preallocate Arrays of Graphics Objects

Use the gobjects function to preallocate arrays for graphics objects. You can fill in each element in the array with a graphics object handle.

Preallocate a 4-by-1 array:

h = gobjects(4,1);

Assign axes handles to the array elements:

for k=1:4
   h(k) = subplot(2,2,k);
end

gobjects returns a GraphicsPlaceholder array. You can replace these placeholders elements with any type of graphics object. You must use gobjects to preallocate graphics object arrays to ensure compatibility among all graphics objects that are assigned to the array.

Was this topic helpful?