How can I make an 2 simultaneous animated line plots?
16 ビュー (過去 30 日間)
古いコメントを表示
1) I wonder if it is possible to do 2 simultaneous plots from the same table as tiles?
I tried it here, but I seem to have an error message, even after I remove all the appearances settings:
%set(groot,'defaultfigureposition',[0 0 1000 1000])
a1 = animatedline;%('color',[1 1 1]);
axis([0 3 0 1650])
a2 = animatedline;%('color',[1 1 1]); % NEW ADD IN
axis([0 3 0 1650]) % NEW ADD IN
%appearances settings
%title('POL AF7 EEG', 'color',[.5 .5 .5])
%xlabel('Time (s)')
%ylabel('Voltage (uV)')
%set(gcf,'color',[0 0 0])
%set(gca,'color',[0 0 0])
%set(gca,'xcolor',[.5 .5 .5])
%set(gca,'ycolor',[.5 .5 .5])
opts = detectImportOptions("d_museMonitor_2021-01-21--18-36-17.csv");
opts.VariableNamesLine = 1;
T = readtable('d_museMonitor_2021-01-21--18-36-17.csv',opts);
fs=256;
t = ((1:height(T))-1)/fs;
v = VideoWriter('2_channel.mp4','MPEG-4');
open(v);
for k = 1:height(T)
tiledlayout(2,1) % NEW ADD IN
nexttile % NEW ADD IN
addpoints(a1, t(k), T.RAW_AF7(k)) % ERROR LINE
title('AF7') % NEW ADD IN
nexttile % NEW ADD IN
addpoints(a2, t(k), T.RAW_AF8(k))
title('AF8') % NEW ADD IN
frame = getframe(gcf);
writeVideo(v,frame);
% set the xlims to create a scrolling window
xlim([max(0, t(k)-3) max(3, t(k))])
drawnow limitrate
end
close(v);
This is the error message:
Error using matlab.graphics.animation.AnimatedLine/addpoints
Value must be a handle.
Error in 2_channel (line 33)
addpoints(a1, t(k), T.RAW_AF7(k))
The image I get I will also attach here.
Thanks in advance for your kindest assistance!
採用された回答
その他の回答 (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!