jeudi 24 novembre 2016

Long and detailed AND,OR conditional IF statements on MATLAB

Could you please tell me what my mistake is on the following code:

if ((i>156-9 && i<156+9) && (j>406-9 && j<406+9)) || ((i>684-11 && i<684+11) && (j>274-11 && j<274+11)) || ((i>1066-15 && i<1066+15) && (j>67-15 && j<67+15)) || ((i>1559-15 && i<1559+15) && (j>867-15 && j<867+15)) || ((i>1082-18 && i<1082+18) && (j>740-18 && j<740+18)) 
    plot(j, i, 'r+', 'MarkerSize', 7, 'LineWidth', 5);
end

I'd like to use an if statement which obeys to get in the expression if one of these conditions are fulfilled:

((i>156-9 && i<156+9) && (j>406-9 && j<406+9))  OR
((i>684-11 && i<684+11) && (j>274-11 && j<274+11)) OR
((i>1066-15 && i<1066+15) && (j>67-15 && j<67+15)) OR
((i>1559-15 && i<1559+15) && (j>867-15 && j<867+15)) OR
((i>1082-18 && i<1082+18) && (j>740-18 && j<740+18))

Thanks in advance... Regards.

Aucun commentaire:

Enregistrer un commentaire