Borrar filtros
Borrar filtros

For Loop using values from x axis

2 visualizaciones (últimos 30 días)
gummiyummi
gummiyummi el 4 de Jun. de 2020
Editada: Takumi el 4 de Jun. de 2020
My x axis has values ranging from -400 to 400
i want to create a for loop which tests whether each xvalue is bigger or smaller than positive/negative 24.
is there a way, perhaps an array?, with which i can do it
  1 comentario
Parveiz Lone
Parveiz Lone el 4 de Jun. de 2020
For x=-400:400 if (×》24) % 》=greater than Disp(x) End End

Iniciar sesión para comentar.

Respuestas (1)

Takumi
Takumi el 4 de Jun. de 2020
Editada: Takumi el 4 de Jun. de 2020
For example, you can check whether x is greater than 24 without using for loops.
x=-400:400;
x(x>=24)
When using a for loop
x=-400:400;
for i=1:length(x)
if x(i)>=24
disp(x(i));
end
end

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by