"IF" condition not working with "<="
3 次查看(过去 30 天)
显示 更早的评论
I am trying to compare two sets of data. One stored as a 1x3 struct as Norm.Block(i).Rlong, the other as Norm.Block(i).Llong
My code is as follows:
for i=1:3
if Norm.Block(i).Rlong <= Norm.Block(i).Llong
Coact.Block(i).RlongLlong=Norm.Block(i).Rlong/Norm.Block(i).Llong;
elseif Norm.Block(i).Rlong>Norm.Block(i).Llong
Coact.Block(i).RlongLlong=Norm.Block(i).Llong/Norm.Block(i).Rlong;
end
end
When i try to run it, the code does not run and in the bottom left corner on MATLAB it just shows "busy". I think the problem is in the if statement but I'm not sure how to solve it.
I am very very new to this so someone please helpe me the solution seems simple but I just can't get it to work :(
Thank you in advance
3 个评论
Bjorn Gustavsson
2020-5-29
The only case I can see where this loop would consume a large amount of time is if some of the Rlong and Llong fields have ended up as large enough arrays to make the Rlong/Llong produce a very big matrix.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!