creating uicontrol in gui without using guide
조회 수: 11 (최근 30일)
이전 댓글 표시
I made a gui using guide. But in my .m gui I need to create a uicontrol but not using guide. The problem I have is that when I create a uicontrol('Style','Edit','Position',[Posx,Posy,w,l]) it plots the uicontrol well, but when I change the position the previous uicontrol is still seen, therefore I have two uicontrols, it seems it does not update the uicontrol and just creates new ones everytime I press a callback button to update the position. If I use the uicontrol in guide it does not show this problem, but I dont want to create it from guide, I will like the user to create a uicontrol if he needs too.
Regards Diego
댓글 수: 1
답변 (1개)
Jan
2011년 2월 4일
You can move the UICONTROL:
Pos = [0.0, 0.0, 0.1, 0.04];
EditH = uicontrol('Style', 'edit', ...
'Units', 'normalized', ...
'Position', Pos);
for i = 1:100
Pos(1:2) = [rand * 0.9, rand * 0.96];
set(EditH, 'Position', Pos);
drawnow;
pause(0.5);
end
If your program creates new UICONTROLs, when a callback runs, it (sorry) creates new UICONTROLs instead of moving the existing one. Please inspect (or post here) the code used for the intentional moving.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!