Position group docked figures proportional to screen size (javaframe)

2 Ansichten (letzte 30 Tage)
Veronica Taurino
Veronica Taurino am 2 Mär. 2021
Kommentiert: Mario Malic am 2 Mär. 2021
Hi! I docked 7 figures within a group (javaframe?). I can't define a position for the whole group. Could you help me? I followed this suggestions by Jan to create the group:
I read few articles on https://undocumentedmatlab.com/ but I could not solve it for now.
My code is something like this:
close all
clear all
f1=figure('WindowStyle', 'normal', 'Name', '1', 'NumberTitle', 'off');
f2=figure('WindowStyle', 'normal', 'Name', '2', 'NumberTitle', 'off');
f3=figure('WindowStyle', 'normal', 'Name', '3', 'NumberTitle', 'off');
f4=figure('WindowStyle', 'normal', 'Name', '4', 'NumberTitle', 'off');
f5=figure('WindowStyle', 'normal', 'Name', '5', 'NumberTitle', 'off');
f6=figure('WindowStyle', 'normal', 'Name', '6', 'NumberTitle', 'off');
f7=figure('WindowStyle', 'normal', 'Name', '7', 'NumberTitle', 'off');
figH = gobjects(1, 7);
figH(1, 1)=f1;
figH(1, 2)=f2;
figH(1, 3)=f3;
figH(1, 4)=f4;
figH(1, 5)=f5;
figH(1, 6)=f6;
figH(1, 7)=f7;
name_files={'1','2','3','4','5','6','7'};
desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
pixels=get(0,'screensize');
myGroup = desktop.addGroup('myGroup');
desktop.setGroupDocked('myGroup', 0);
myDim = java.awt.Dimension(4, 2);
desktop.setDocumentArrangement('myGroup', 2, myDim)
bakWarn = warning('off','MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');
for iFig = 1:7
figH(1, iFig).Position=[0 0 800 300]; %desired position
figH(1, iFig).WindowStyle='docked';
drawnow;
pause(0.05);
set(get(handle(figH(iFig)), 'javaframe'), 'GroupName', 'myGroup');
end
desktop.setDocumentArrangement('myGroup', 1, myDim)
  3 Kommentare
Mario Malic
Mario Malic am 2 Mär. 2021
See figure properties: Position and Units. If you set Units to normalized, you don't need to work with resolution.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu MATLAB Coder finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by