How can I slow down the plotting speed?
35 次查看(过去 30 天)
显示 更早的评论
I would like to change the plotting speed of the following code.
I've tried to edit the TimeStamps part like these
subplot(2,1,1)
plot(t1/100,s1)
ylim([-10.0 10.0]);
title('s_1')
subplot(2,1,2)
plot(t1/100,s2)
ylim([-10.0 10.0]);
title('s_2')
xlabel('Time (s)')
but the plotting speed was not changed.
Entire Code
tx = daq.createSession('ni');
s = daq.createSession('ni');
s.Rate = 400000;
ultraFreq = 40000;
numCycle =8
addAnalogOutputChannel(tx, 'Dev1', 'ao0', 'Voltage');
th=addlistener(tx, 'DataRequired', @queueMoreData);
addAnalogInputChannel(s,'Dev1', 'ai0', 'Voltage');
ch = addAnalogInputChannel(s, 'Dev1', 'ai1', 'Voltage');
h = addlistener(s, 'DataAvailable', @plotData);
s.DurationInSeconds(1);
queueOutputData(tx, y');
startBackground(s);
tx.startForeground();
function plotData(src, event)
t1 = event.TimeStamps(:,1);
s1 = event.Data(:,1);
s2 = event.Data(:,2);
subplot(2,1,1)
plot(t1,s1)
ylim([-10.0 10.0]);
title('s_1')
subplot(2,1,2)
plot(t1,s2)
ylim([-10.0 10.0]);
title('s_2')
xlabel('Time (s)')
end
function queueMoreData(src, event)
queueOutputData(tx, y');
end
0 个评论
采纳的回答
KSSV
2019-5-1
Read about pause
2 个评论
Walter Roberson
2019-5-4
In the code I showed you in https://www.mathworks.com/matlabcentral/answers/459534-how-to-write-a-video-file-with-analog-plots#answer_373541 you could change the
drawnow()
to
drawnow limit
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!