필터 지우기
필터 지우기

How do I plot on multiple graphs and have them update within a GUI?

조회 수: 3 (최근 30일)
alex korzaniewski
alex korzaniewski 2013년 4월 6일
I have two plots in a GUI (circleAxes, and lineAxes). On the circleAxes plot I have multiple data being plotted and updated, however, when I added the other plot in the GUI (lineAxes), only the last data is plotted on cicrleAxes. Is there a way to plot and update the data I want on cicrleAxes while also plot other data on lineAxes? This is the code that plots and updates the data for circleAxes. When I added lineAxes in GUIDE, the data I want does not plot.
theta = 0 : deg2rad(5) : (2 * pi);
pline_x = 3 * cos(theta) + 0;
pline_y = 3 * sin(theta) + 0;
x=-5:.25:-3;
x2 = 3:.25:5;
x3 = 0;
y=0;
a= round(round(-roll)-90); %change roll to accelerometer data
a_rad=((a*pi)./180);
[THETA,R] = cart2pol(x,y);
THETA=THETA+a_rad;
[xr,yr] = pol2cart(THETA,R);
a= round(round(-roll)-90.);
a_rad=((a*pi)./180);
[THETA2,R2] = cart2pol(x2,y);
THETA2=THETA2+a_rad;
[xr2,yr2] = pol2cart(THETA2,R2);
plot(handles.circleAxes, pline_x, pline_y, 'or',...
'MarkerFaceColor', 'r','MarkerSize', 4);
hold on
plot(handles.circleAxes,xr,yr-.25,'or','LineWidth', 2,'MarkerSize', 5);
plot(handles.circleAxes, xr2, yr2-.25, 'or', 'LineWidth', 2, 'MarkerSize', 5);
plot(handles.circleAxes,xr,yr+.25,'or','LineWidth', 2,'MarkerSize', 5);
plot(handles.circleAxes, xr2, yr2+.25, 'or', 'LineWidth', 2, 'MarkerSize', 5);
plot(handles.circleAxes, x3, y, 'sr', 'LineWidth', .5, 'MarkerSize', 10);
if(trigger == 1)
plot(handles.circleAxes, x3, y, 'sr', 'MarkerSize', 50);
end
axis equal
set(handles.circleAxes, 'XLim', [-5 5], 'YLim', [-5 5], 'XTick', [],...
'YTick', [],'Color', 'none','box', 'off', 'Visible', 'off');
hold off

답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by