Why can't I change my WindowStyle setting ?

108 views (last 30 days)
Sebastian Sigler
Sebastian Sigler on 13 Jul 2016
Commented: woo jin kim on 16 Jan 2023
Hi, I am a Matlab programming beginner and I am trying to use the Matlab Report Generator to print several figures. I would like to change some figure properties before printing them, like the color, units and position:
figure
plot(randn(100,1));
set(gcf,'units','centimeters');
set(gcf,'WindowStyle','normal');
set(gcf,'Color',[1 1 1]);
set(gcf,'position',[10 10 18 9]);
The execution of that command works just fine and I get a normal figure with the changes I wanted but when I try to run the file with the Report Generator none of the changes are applied to my figure. Usually I get the error message "Cannot set Position while WindowStyle is 'docked'". When I check the figure properties, the WindowStyle is 'docked' (which is weird because the default value itself should be 'normal' and I explicit changed it to 'normal').
Can someone help me fix this annoying problem ?

Answers (1)

Sudhanshu Bhatt
Sudhanshu Bhatt on 19 Jul 2016
Hi Sebastian,
Sometimes, while working with figures, if the figure window is docked unknowingly, it might give the docking error message. To verify this, you can type in the following command in the MATLAB command prompt:
>> get(0,'DefaultFigureWindowStyle')
If the output of this command is 'Docked', then the figure window is docked and you can use the following command to undock it:
>> set(0,'DefaultFigureWindowStyle' , 'normal')
Once the figure window is undocked, please try using the report generator tool again.
If this does not resolve you issue, please create a case with MathWorks Technical Support by using the URL below:
Hope this helps!
Thanks
Sudhanshu Bhatt

Community Treasure Hunt

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

Start Hunting!