how can i plot in axes in other figure

2 views (last 30 days)
i have a figure 1 and i wish plot in axes 2 in figure2 within a callback push bouton of the first figure????????? i will be presaure

Accepted Answer

Walter Roberson
Walter Roberson on 3 Nov 2015
If ax2 is a handle to the appropriate axes in figure 2, then
plot(ax2, .... whatever you want to plot)
For example
fig2 = figure(2);
ax2 = findobj(fig2, 'tag', 'axes2'); %retrieve the handle from the figure
plot(ax2, t, pressure);
  1 Comment
ali hadjer
ali hadjer on 3 Nov 2015
my code in figure 2 axes2=handles.axes2 and my code in figure one in call back buton: function pushbutton4_Callback(hObject, eventdata, handles)
optimisationfigure;
handles.axes2=gca;
if isfield(handles,'net')
for i = 1:numel(handles.net(1,:))
for j = 1:numel(handles.net(1,:))
X1 = handles.net(2,i);
Y1 = handles.net(3,i);
X2 = handles.net(2,j);
Y2 = handles.net(3,j);
xSide = abs(X2-X1);
ySide = abs(Y2-Y1);
d = sqrt(xSide^2+ySide^2);% distance euclidienne
DD(:,i)=d;
disp(DD);
if (d<=handles.r)&&(i~=j)
plot([X1,Y1],[X2,Y2],'o','LineWidth',0.1);
hold on;
end
end
end
end
and itsn t worker ???

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!