如何每秒钟,按照顺序读去数组的一个值?。

请大神指教一下:
如何每隔几秒钟,按照顺序读取数组的一个值?

 采纳的回答

rusidun
rusidun 2022-10-28

0 个投票

提供一个笨拙的方法
假设数组a是 1 2 4 9,储存数组为b
%%%%
a = [1 2 4 9];
b = zeros(1,4);
for i = 1:4
pause(2) %暂停2秒
b(1,i) = a(1,i)
end
%%%%
这样就是以两秒为间隔读取数组a中的元素并储存在b中,每读取一次都会显示出来。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 时序事件 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!