Question

For some reason I am unable to resize the workspace size of a GUI figure using MATLAB's built in GUIDE editor. Every time I do so (by dragging the corner of the workspace), I get a warning in MATLAB's console stating:

Warning: Cannot set Position while WindowStyle is 'docked' 
> In guidefunc>resizeFigure at 2693
  In guidefunc at 116 

I have tried setting the default window style to 'normal' (set(0,'DefaultFigureWindowStyle','normal')) to no avail.

I see no reports of this strange behaviour elsewhere online, and wonder if anyone else has experienced this?

Am using MATLAB R2012a. Any thoughts appreciated(!)

Was it helpful?

Solution 2

Default-Window-Style and Window-Style are two different things. If you want to change the WindowStyle, you should use that property. In addition take care for the handle of the figure!

%get handle:
myFigure= findobj('Tag','SomeUniqueTagHere') %make sure to get the right one
set(myFigure,'WindowStyle','normal')

I guess (but I'm not absolutely sure) default-properties will just be used during creation.

OTHER TIPS

Improving upon Lucius' answer, I was able to resize the figure after using the following command on the workspace window.

set(gcf,'WindowStyle','normal')

This command helps sets the window style to normal and hence is resize-able.

I am using Matlab R2020b and the figure under question was selected (highlighted) before I ran this command.

You can resize the workspace in GUI and therefore avoid the error message

Warning: Cannot set Position while WindowStyle is 'docked'

by changing the setting WindowStyle in the GUI. To the end you should:

  1. Go to the GUI
  2. Double click on the background, which makes appear the inspector panel.
  3. Go to the property WindowStyle and change it from docked to normal.

After that you can resize your workspace normally.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top