Why a figure window with a certain figure number cannot be opened?

Hello.
Opening a figure window by typing ">figure;" in my startup.m leads to the following strange behavior:
Waiting 5-10sec after the start of Matlab and then executing >figure(2); does not produce a new figure window. Typing >figure will open Figure 3, but Figure 2 will now be missing completely from the session.
Interestingly, opening two figure windows in startup.m by executing ">figure; figure;" does open Figures 1 and 2 as expected. However, now Figure 3 is impossible to open!
Similarly, opening one figure in startup.m and then typing >figure as quickly as possible upon the start of the session opens Figure 2 successfully. So it seems that the "missing figure" is the first one which I try opening after some time interval following the opening of the first batch of figures. I.e. opening four figures via startup.m and waiting for 5-10 sec before opening another figure in the session will make Figure 5 inaccessible, not even after any of the open figures is closed.
Any help with recovering the "missing figure" will be appreciated.
Thanks,
Valery.

Réponses (1)

madhan ravi
madhan ravi le 3 Juil 2020
That’s why you should assign a handle to the figure.

5 commentaires

Doesn't look like that's it.
I typed h1=figure; in startup.m
After starting up and waiting a few seconds, executed:
>> h2=figure(2)
h2 =
Figure (2: Figure) with properties:
Number: 2
Name: 'Figure'
Color: [0.9400 0.9400 0.9400]
Position: [530 558 560 420]
Units: 'pixels'
But the figure itself is nowhere to be seen!
I’m not sure I’m following , what if
figure(h2)
figure(h2) does not do anything, despite
>> h2
h2 =
Figure (2: Figure) with properties:
Number: 2
Name: 'Figure'
Color: [0.9400 0.9400 0.9400]
Position: [530 558 560 420]
Units: 'pixels'
Can you show us the output of this command?
get(h2)
>> get(h2)
Alphamap: [1×64 double]
BeingDeleted: off
BusyAction: 'queue'
ButtonDownFcn: ''
Children: [0×0 GraphicsPlaceholder]
Clipping: on
CloseRequestFcn: 'closereq'
Color: [0.9400 0.9400 0.9400]
Colormap: [256×3 double]
ContextMenu: [0×0 GraphicsPlaceholder]
CreateFcn: ''
CurrentAxes: [0×0 GraphicsPlaceholder]
CurrentCharacter: ''
CurrentObject: [0×0 GraphicsPlaceholder]
CurrentPoint: [0 0]
DeleteFcn: ''
DockControls: on
FileName: ''
GraphicsSmoothing: on
HandleVisibility: 'off'
InnerPosition: [530 558 560 420]
IntegerHandle: on
Interruptible: on
InvertHardcopy: on
KeyPressFcn: ''
KeyReleaseFcn: ''
MenuBar: 'none'
Name: 'Figure'
NextPlot: 'add'
Number: 2
NumberTitle: on
OuterPosition: [530 558 560 420]
PaperOrientation: 'portrait'
PaperPosition: [1.3333 3.3125 5.8333 4.3750]
PaperPositionMode: 'auto'
PaperSize: [8.5000 11]
PaperType: 'usletter'
PaperUnits: 'inches'
Parent: [1×1 Root]
Pointer: 'arrow'
PointerShapeCData: [16×16 double]
PointerShapeHotSpot: [1 1]
Position: [530 558 560 420]
Renderer: 'painters'
RendererMode: 'auto'
Resize: on
Scrollable: off
SelectionType: 'normal'
SizeChangedFcn: ''
Tag: ''
ToolBar: 'none'
Type: 'figure'
Units: 'pixels'
UserData: []
Visible: off
WindowButtonDownFcn: ''
WindowButtonMotionFcn: ''
WindowButtonUpFcn: ''
WindowKeyPressFcn: ''
WindowKeyReleaseFcn: ''
WindowScrollWheelFcn: ''
WindowState: 'normal'
WindowStyle: 'docked'
So both 'HandleVisibility' and 'Visible' are 'off', which is why the figure is invisible. Switching Visibility to 'on' brings it on the screen, but the question is still why is this figure created with 'HandleVisibility' and 'Visible' set to off, unlike any other figure?

Cette question est clôturée.

Produits

Version

R2020a

Clôturé :

le 20 Août 2021

Community Treasure Hunt

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

Start Hunting!

Translated by