Why does the FIGURE command create two figures when I set the colormap property in MATLAB 7.3 (R2006b)?

2 次查看(过去 30 天)
I am creating a figure using the FIGURE command in MATLAB 7.3 (R2006b). When I set the 'Colormap' property of the figure to "gray" using the following statement:
h = figure('Colormap',gray);
two figures are generated instead of one.

采纳的回答

MathWorks Support Team
This behavior is expected, and is due to the following:
If there are no input arguments to GRAY, the colormap property value 'gray' will call GCF to get the default Colormap length, and this will create the new figure.
As a workaround, specify the colormap length in the command as follows:
h = figure('Colormap',gray(256));

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Colormaps 的更多信息

标签

尚未输入任何标签。

产品


版本

R2006b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by