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

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

 Respuesta aceptada

rusidun
rusidun el 28 de Oct. de 2022

0 votos

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

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 28 de Oct. de 2022

Respondida:

el 28 de Oct. de 2022

Community Treasure Hunt

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

Start Hunting!