Multiple animated lines in two different figures plotted simultaneously
Show older comments
Hello,
I am currently using a self built 3D-printed pressure sensor to get realtime reading in terms of change in the capacitance. The sensor has two different sensing areas. I currently have a code which displays the pressure from those two sensing areas, as shown in the figure below.
I would like to have another figure along with this, which display load values from the same sensor simultaneously. So, two figures, one as the same figure below and another figure with converted load values displayed simultaneously. Instead of two figures, a subplot would also work I suppose. The entire code is in a while loop. I tried the following:
figure(1)
h = animatedline('Color','r','LineWidth',1);
h2 = animatedline('Color','b','LineWidth',1);
figure(2)
h3 = animatedline('Color','g','LineWidth',1);
h4 = animatedline('Color','m','LineWidth',1);
ax = gca;
ax.YGrid = 'on';
ax.YLim = [-200 400];
legend('1','2')
while ~stop
% After reading the input from the sensor
addpoints(h,datenum(t),senleft)
addpoints(h2,datenum(t),senright)
addpoints(h3,datenum(t),strru1)
addpoints(h4,datenum(t),strrd1)
end
Thank you in advance. Please let me know if you need any further information.

Accepted Answer
More Answers (0)
Categories
Find more on Animation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
