Info

This question is closed. Reopen it to edit or answer.

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

1 view (last 30 days)
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.

Answers (1)

madhan ravi
madhan ravi on 3 Jul 2020
That’s why you should assign a handle to the figure.
  5 Comments
Valery Milner
Valery Milner on 3 Jul 2020
>> 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?

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!