"Or Statement in And statement" using if operator
76 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Doris
el 30 de Mayo de 2016
Editada: per isakson
el 24 de Nov. de 2017
Hello everyone,
I have a very simple question....and I have been working on it for some time but cannot figure it out. I try to write the statement that condition 1 : Test(i-1) or Test(i-2) =0, condition 2: Test(i+1) or Test(i+2) =0, when condition 1 and condition 2 are true then the statement is true. I tried to write the code but it did not work at all.
for i = 3:N-2
if Test(i-1)==0||Test(i-2)==0 && Test(i+1)==0||Test(i+2)==0
end
end
Thanks for the help in advance :)
0 comentarios
Respuesta aceptada
Stephen23
el 30 de Mayo de 2016
Editada: Stephen23
el 30 de Mayo de 2016
if (A || B) && (C || D)
Note that you should not use i (or j) for loop variable names, as these are names of the inbuilt imaginary unit.
5 comentarios
Stephen23
el 31 de Mayo de 2016
Editada: Stephen23
el 31 de Mayo de 2016
In my last comment I explained why that test probably failed (because the value isn't really zero). The solution to this is also explained in my last comment.
If you upload a .mat file with those value then I can check the values, and show you how you can compare them in a more robust manner.
Más respuestas (1)
arief hidayat
el 24 de Nov. de 2017
Editada: per isakson
el 24 de Nov. de 2017
hi i got same issue when i running script as below :
if ((rate ~= rate_tx || (Nbpsc ~= Nbpsc_tx) || (psdu_byte ~= psdu_byte_tx)))
Percounter = 1;
noviterbi_Y = [];
PSDU = [];
return ;
else
Percounter = 0;
help me please
0 comentarios
Ver también
Categorías
Más información sobre Conversion Between Symbolic and Numeric 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!