Selecting four elements then starting again.

1 visualización (últimos 30 días)
Lukasz Skowron
Lukasz Skowron el 18 de Oct. de 2018
Respondida: Erivelton Gualter el 22 de Oct. de 2018
Hi,
I want to create a program that selects first then second, then third, then fourth element from A = linspace(0,3,4) and then srarting again and then stopping at some point and that is the problem I know how to create a code that doesn't stop but I want it to stop at some point, please can you help me with that and show example code that does this?
Thanks.

Respuesta aceptada

Erivelton Gualter
Erivelton Gualter el 22 de Oct. de 2018

Check the following code. I am not sure that is what you need, but it performs what you said in my understanding.

A = linspace(0,3,4);
Nth = 6;
for i=1:fix(Nth/4)
    for i=1:length(A)
        disp(A(i));
        pause(0.5)
    end
end
for i=1:mod(Nth,4)
    disp(A(i));
    pause(0.5)
end

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by