what does the "-1" means in conditional statement?
2 次查看(过去 30 天)
显示 更早的评论
Hi I am trying to understand a code which has some "if" statemets.
Now normally we pass true or false to the if else statement right? but in this case the state has a -1 what does this -1 means?
here is the line of code that I am trying to understand
for i=1:CT.MaxSatNum
clear tempsat;
if (SimGlobal.aSatData(i).sOrbitData.sEphData.PRN~=-1)
0 个评论
采纳的回答
DGM
2022-1-25
Entering the if structure isn't conditional on -1, it's conditional on whether SimGlobal.aSatData(i).sOrbitData.sEphData.PRN is not equal to -1. The output of that test is a logical value.
A = 2;
if (A ~= -1)
disp('tested true')
end
A ~= -1 % this returns a logical scalar
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!