Guide components missing due to y position > 1
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Jason
am 10 Jan. 2019
Kommentiert: Adam Danz
am 10 Jan. 2019
Hello, I have noticed when I open up an old matlab GUI (created using GUIDE) from back in 2015, some of the components are missing near the top of the figure.
I noticed that their y-position has somehow changed to be > 1 as shown below (1.16). Is there a way to correct & stop this?
n
Thanks
Jason
7 Kommentare
Adam Danz
am 10 Jan. 2019
Before opening the hood, I'd open the GUI in matlab 2015 again (if possible) to confirm that this is a problem with the matlab version. I'd also confirm that the units are normalized. Sometimes merely closing and restarting matlab will fix these quirks. You mentioned that the screen was affected too which suggests a bigger problem.
Akzeptierte Antwort
Adam Danz
am 10 Jan. 2019
The idea is to find objects within the GUI whose positions are outside of the GUI frame. The code below should be run from within the GUI within any callback function or at the end of the initializer function and requires the 'handles' vector which is a structure listing all handles within the GUI.
handleVec = struct2array(handles); %handles is the handles structure
positions = get(handleVec, 'Position');
xPos = cellfun(@(x)x(1), positions);
yPos = cellfun(@(x)x(2), positions);
isout = xPos > 0.99 | yPos > 0.99;
handleVec(isout) %this lists all handles outside of the GUI frame
The next step depends on how many objects you have to move. If it's just a few, it might be best to just get the names of each object and then make the adjustments from within guide. If there are lots of objects, you'll need to manually place each of them from within the initializer function.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps 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!