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

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

 Réponse acceptée

rusidun
rusidun le 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中,每读取一次都会显示出来。

Plus de réponses (0)

Catégories

Tags

Community Treasure Hunt

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

Start Hunting!