MATLAB Answers

how to write or condition in if statement matlab?

5 views (last 30 days)
if
(j==i) , or (flag(j)==1)

  0 Comments

Sign in to comment.

Accepted Answer

Akshay Malav
Akshay Malav on 21 Jun 2019
if (j==i) | (flag(j)==1)
% your code
end

  0 Comments

Sign in to comment.

More Answers (1)

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

  6 Comments

Show 3 older comments
Sultan Mehmood
Sultan Mehmood on 21 Jun 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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by