Change one specified axes to current axes when two axes exists
14 views (last 30 days)
Show older comments
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.
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,
But when I clicked Button Query again, the result is wrong, as the following image.
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 Comments
Answers (1)
Walter Roberson
on 7 Jan 2014
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 Comments
See Also
Categories
Find more on Graphics Object Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!