Matlab Operators

前端 未结 1 1712
你的背包
你的背包 2021-01-27 02:05

I am studying for cumulative exam I have tomorrow and I got the following question wrong on a previous exam. I was hoping someone could explain this question to me? What does (~

相关标签:
1条回答
  • 2021-01-27 02:57

    The ~ means NOT. However, numeric values are all considered TRUE unless they are identically equal to 0.

    So, the commands which are actually executed by this logic are:

    m = m+1;  %Following if (~m)
    m = m-1;  $Following else
    

    Also, there is a nested if statement in the code. It will be easier to read if you used multiple level indentations.

    0 讨论(0)
提交回复
热议问题