Handling axes as arguments
13 ビュー (過去 30 日間)
In my GUI, there are 5 axes, one displays a grid of images, and the others display the cropped images from the grid having one cropped image from mouse input to be displayed on one axis in a sequence i.e. an image password of having four sub-images will be formed further. At first I was setting the new axis for the next cropped image by handling it in a loop. There were warnings regarding speed. Then I passed the handles in arguments as:
a2 = axes(handles.axes2);
a3 = axes(handles.axes3);
a4 = axes(handles.axes4);
before my loop started. and within the loop I ploted where I wanted:
now it gives me these errors:
Error using axes Too many output arguments.
Error in a2 = axes(handles.axes2);
Thanks in advance!
回答 (1 件)
Mike Garrity 2016 年 5 月 4 日
Axes only returns an axes handle in the cases where it is creating an axes object. The syntax where you pass an axes handle in is different. In that case, it's not creating an axes, it's just setting gca. It sounds like you probably want something like this instead.
a2 = handles.axes;
Alternatively, you could skip the call to axes entirely. It looks like you're going to pass the axes handle into your plotting function. Therefore you really don't need to make it gca. But making it gca does have the nice side effect of making sure that the figure is in front of other windows.