Change one specified axes to current axes when two axes exists
조회 수: 11 (최근 30일)
이전 댓글 표시
Just as the following image shows, two axes exists in the figure, whose tag are axes_query and axes_output , respectively. I want to implement these functions:
1) click the Button open to display only one image on the axes_query.
2) click another button(not shown in the image, named Query) to display several images on the axes_output.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154707/image.png)
The first step is to set axes_query current axes when the Open is clicked. And then, when button Query is clicked, set axes_ouput current axes.I use the code :
% set axes_query current axes
axes_qh = findobj('Tag','axes_query');
set(fig_main, 'CurrentAxes', axes_qh); % fig_main are the handle of figure.
...
% set axes_output current axes
axes_op = findobj('Tag','axes_output');
set(fig_main, 'CurrentAxes', axes_op);
These code works well when the Query button is clicked firstly.As the following image shows,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154711/image.png)
But when I clicked Button Query again, the result is wrong, as the following image.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154723/image.png)
The current axes is axes_query,not axes_output. I am confused about this issue. When the button Open is clicked, I set axes_query current axes. And when thw button Query is clicked, I set axes_output current axes. BUT,I have no idea why the current axes is not axes_output when the Query is repeated clicked.
Any one give me some suggestion?
댓글 수: 0
답변 (1개)
Walter Roberson
2014년 1월 7일
The best way to fix this is to not use a current axes. Instead, for each operation, name the axes it is to happen on. See http://www.mathworks.co.uk/matlabcentral/answers/22208-show-figure
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Object Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!