是否有辦法使條件成立,如果在if
下的語句/矩陣中出現錯誤,則執行else
下的語句?當'if'部分下的語句出現錯誤時,如何將控件移動到「if-else」的else部分?
即,
if (some condition)
some statment1/matrix1/variable1
some statement2/matrix2/variable2
some statement3/matrix3/variable3
else newstatement/matrix %come to else part of the code if any of the statements 1,2 or 3 under if condition yields any error like dimension mismatch or anyother
end
你try-catch塊缺少catch語句 – Matt
@馬特我知道。如果你不關心錯誤細節,你可以禁止警告'丟失catch語句並忽略它。如果catch序列被執行,其他代碼將被執行。 – Crowley