I have the following if statement with multiple conditional statements:
where d_1(1,1,) = 6 % iteration limit
s = 1 % iteration count
for s = 1:d_1(1,1) if s <= sz_dist_obs(1,1) && d_0_ij(1:sz_dist_obs(1,1),1) == distance_obs(1,1) && d_0_ij (1:sz_dist_obs(1,1),2) == distance_obs(1,2) obs_dist_m(s,1) = distance_obs(s,1) obs_dist_m(s,2) = distance_obs(s,2) obs_dist_m(s,3) = distance_obs(s,3) s=s+1end
Returns the following error:
Operands to the and && operators must be convertible to logical scalar values.
I am assuming that because the condition after the && is not a scalar, but rather a conditional statement that this is where the problem lies.
Is this correct?
Is there another way of stipulating multiple conditions in the single if statement?
Best Answer