How to use 2 forloop in matlab?

1 visualización (últimos 30 días)
Muhammad Andi Yusran
Muhammad Andi Yusran el 17 de Mzo. de 2020
Comentada: Muhammad Andi Yusran el 17 de Mzo. de 2020
I have a Mat-file. My Mat-file have 204 length. How can i just get from length 1 to 51 from my Mat-file? How can i use another forloop in my code to get i = 1 till i = 51? This is my code.
a = 0;
m = matfile('elm_output.mat');
output = m.output;
for i = 1:length(output)
if output(i) == 1
a = a+1;
end
end

Respuesta aceptada

Bhaskar R
Bhaskar R el 17 de Mzo. de 2020
required = output(1:51);
  2 comentarios
Bhaskar R
Bhaskar R el 17 de Mzo. de 2020
Do you mean?
required = output(1:51);
one_two_values = required(required == 1 | required == 2)
Muhammad Andi Yusran
Muhammad Andi Yusran el 17 de Mzo. de 2020
Yes Mr. Bhaskar, but i can figure it out now. Thanks for your attention sir. Thank you so much.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by