If statement with multiple condition
显示 更早的评论
Hi,
I read few post and could not solve my issue with if statement. I have the following code but it doesn't work!
i=1;
for j = 1 : height (reduced)
if (Boarder_Lat_lower < reduced(j, 4)) && (reduced(j, 4) < Boarder_Lat_upper) && (Boarder_Long_lower < reduced (j, 5)) && (reduced (j, 5) < Boarder_Long_upper)
Selected_2011 (i, :) = reduced (j, :);
i= i+1 ;
end
end
The problem is with multiple conditions separated with "and".
Thank you for the help
7 个评论
James Tursa
2016-9-22
What is the specific problem? Why are you incrementing j inside the for loop that already has j as an index? Are you intentionally trying to get j to increment by 2 each iteration? Or ...?
Kaveh Kel
2016-9-22
编辑:Walter Roberson
2016-9-22
Walter Roberson
2016-9-22
Are you getting an error message, or is it just not behaving as you expect?
Kaveh Kel
2016-9-22
James Tursa
2016-9-22
Can you please post the error message? Copy and paste the entire message.
Walter Roberson
2016-9-22
The code would be in error if any of the Boarder_* variables are not scalars.
Kaveh Kel
2016-9-22
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Tables 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!