我正在嘗試使用以下代碼在應用程式設計器中添加一個開關:
function SwitchValueChanged(app, event)
value = app.Switch.Value;
if (value == 'Off')
app.SaveOIButton.Enable = 'Off';
app.OpenOIButton.Enable = 'Off';
end
if (value == 'On')
app.SaveOIButton.Enable = 'On';
app.OpenOIButton.Enable = 'On';
end
end
但我收到此錯誤:
Arrays have incompatible sizes for this operation.
Error in Mie/SwitchValueChanged (line 82)
if (value == 'Off')
Related documentation
Error while evaluating Switch PrivateValueChangedFcn.
知道為什么嗎?
uj5u.com熱心網友回復:
嘗試(我沒有運行它):
function SwitchValueChanged(app, event)
switch app.Switch.Value
case 'Off'
app.saveOIButton.Enable = 'off';
app.openOIButton.Enable = 'off';
case 'On'
app.saveOIButton.Enable = 'on';
app.openOIButton.Enable = 'on';
end
end
我使用 switch 來評估一個運算式并選擇執行幾組陳述句中的一個。每個選擇都是一個案例。switch 塊測驗每個案例,直到其中一個案例運算式為真(https://www.mathworks.com/help/matlab/ref/switch.html)
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/411467.html
標籤:
上一篇:CocoaPods錯誤:忽略ffi-1.14.2,因為它的擴展未構建
下一篇:在Java中移動標簽
