How to prevent one figure from resizing while another figure continuously updates?
조회 수: 3 (최근 30일)
이전 댓글 표시
I have two plots generated by the code below. The first is a hinton weight matrix (deep learning toolbox) and the second is the voltage read from an arduino. When I run the code, the voltage plot works as expected where it displays the last 25 seconds and continues to update.
The problem I'm having is as the voltage plot continues to update, the hinton weight matrix keeps resizing. I'd like to have the hinton weight matrix to open and only update if a value in the matrix changes.
a = arduino;
%-------------------------------------------------------------------------
x = -1*ones(5,5);
figure(1)
hintonw(x)
axis off
axis manual
%-------------------------------------------------------------------------
% Variables
time = 0;
data = 0;
count = 0;
% Set up Plot
figure(2)
plotGraph = plot(time,data,'-r' );
grid on;
tic
while ishandle(plotGraph)
dat = readVoltage(a,'A0');
count = count + 1;
time(count) = toc;
data(count) = dat(1);
set(plotGraph,'XData',time,'YData',data);
ylim([0 3.3])
if time(count) > 20
xlim([(time(count)-20) time(count)])
else
xlim([0 time(count)])
end
pause(0.01);
end
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Animation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!