How to detect negative number in Switch and case statement
古いコメントを表示
I want to implement some control actions based on the sign of the error and Uz.
when error = -1, Uz = -1.
The output is 'other value' instead of 'Object losing altitude'.
Please how can I correct it.
Thank you for the help.
error = -1;
Uz = -1;
switch error
case error > 0 && Uz > 0
disp('Controller should not take any action')
case error > 0 && Uz < 0
disp('Open the control valve and supply more lifting gas')
case error < 0 && Uz < 0
disp('Object losing altitude')
otherwise
disp('other value')
end
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Oceanography and Hydrology についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!