how to write or condition in if statement matlab?

 Respuesta aceptada

Más respuestas (1)

Shwetank Shrey
Shwetank Shrey el 21 de Jun. de 2019
Check out the documentation:
if (j == i) || (flag(j) == 1)
% do something
end

6 comentarios

Sultan Mehmood
Sultan Mehmood el 21 de Jun. de 2019
Operands to the || and && operators must be convertible to logical scalar values.
Error in exppppp (line 19)
if (j==i) || (flag(j)==1)
not working.
madhan ravi
madhan ravi el 21 de Jun. de 2019
You need to explain what is your desired result and what you’re trying to do.
You would have gotten this when i and/or j are arrays.
if all(j == i) || (flag(j) == 1)
% do something
end
If this still does not work, flag(j) might be returning an array too and you can add an all statement for that too.
Sultan Mehmood
Sultan Mehmood el 21 de Jun. de 2019
j=mod(floor(x*10^15),L)+1;
checking the value of j and flag(j), if (j==i), 0r (flag(j)==1), then repeat ''j'' ;else then go to .
flag(j)<-----1; t(i)<--------j.
madhan ravi
madhan ravi el 21 de Jun. de 2019
What is i here , loop iterator?
Sultan Mehmood
Sultan Mehmood el 21 de Jun. de 2019
yes
i=1:65536;
L=65536;

Iniciar sesión para comentar.

Categorías

Más información sobre Data Import from MATLAB en Centro de ayuda y File Exchange.

Preguntada:

el 21 de Jun. de 2019

Comentada:

el 21 de Jun. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by