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

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

 Accepted Answer

rusidun
rusidun on 28 Oct 2022

0 votes

提供一个笨拙的方法
假设数组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中,每读取一次都会显示出来。

More Answers (0)

Categories

Tags

Asked:

on 28 Oct 2022

Answered:

on 28 Oct 2022

Community Treasure Hunt

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

Start Hunting!