Handling axes as arguments
13 ビュー (過去 30 日間)
古いコメントを表示
Help needed...
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);
a5= axes(handles.axes5);
before my loop started. and within the loop I ploted where I wanted:
switch password_count
case 0
plot (a2);
password_array(1)=temp_im; %#ok
case 1
plot (a3);
password_array(2)=temp_im; %#ok
case 2
plot (a4);
password_array(3)=temp_im; %#ok
case 3
plot (a5);
password_array(4)=temp_im; %#ok
end
now it gives me these errors:
Error using axes Too many output arguments.
Error in a2 = axes(handles.axes2);
Thanks in advance!
0 件のコメント
回答 (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.
axes(handles.axes2)
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.
2 件のコメント
Stephen23
2016 年 5 月 4 日
@Mike Garrity: it might be nice if axes returned the handle for all cases, even where it does not create a handle. Or is this special output case useful somehow?
Mike Garrity
2016 年 5 月 4 日
I'm afraid I don't know the history of that one. I'm afraid that it goes way, way back.
We have been on a bit of a kick of making things more uniform lately. Perhaps this one should be on the todo list.
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!