所以我正在创建一个应用程序来计算基于一系列变量的值。变量是:
- 性别
- 年龄
- 重量
- 肌酐
这是应用程序的外观:
为了稍微简化过程,我决定将性别选择设为下拉菜单,这给我带来了一些问题,因为我的设置如下:
与按钮相关的数学如下所示:
function CalculateButtonPushed(app, event)
gender = app.PatientGenderDropDown.Value ;
age = app.PatientAgeEditField.Value ;
weight = app.LeanBodyWeightEditField.Value ;
serum = app.SerumCreatinineEditField.Value ;
final = (gender*(age)*weight) / (serum) ;
app.ResultEditField.Value = final ;
end
end
运行它会出现以下错误:
使用 matlab.ui.control.internal.model.AbstractNumericComponent/set.Value 时出错(第 104 行)'Value' 必须是数字,例如 10。
据我所知,我输入的值ItemsData
是数值。我错过了什么还是有更好的方法来做到这一点?