how to see my plot in GUI axes.

I have a GUI using Guide. Now in a button callback I am calling a function Test.m, which creates a plot. The plot is being created in a figure and not in axes, though I used.
axes(handles.axes1);
%imshow(figure(1));
Code for the Button callback goes here:
function calculate_Callback(hObject, eventdata, handles)
axes(handles.axes1);
%imshow(figure(1));
Test;
imshow(Test);
Help!
[EDITED, Jan, code formatted - please follow the "? Help" link]

Answers (1)

Without seeing the contents of Test.m, we cannot know why a new figure is created. Perhaps there is a figure() command in this function?
You start Test twice - is this intented?
The most secure method to specify the parent axes (and in consequence the parent figure also) is to define this explicitly:
function Test(AxesHandle)
plot(AxesHandle, 1:10, rand(10, 10))
end
Then changes of the current AXES object by a TIMER callback or user interaction do not have any influence anymore.

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Asked:

on 30 Apr 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!