Limits of app-designer spinner input field

조회 수: 14 (최근 30일)
Leon
Leon 2021년 3월 16일
댓글: Leon 2021년 3월 16일
I have an app-designer spinner input field called app.A. I can set its limits by below:
app.A.Limits = [1, max(cruiseList)];
Here is the problem, if I only have one cruise and the max(cruiseList) is equal to one, the system will throw out an error?
Why can't I have the min and max values to be equal when my only option at this situation should be no other option, i.e., just 1?
Thanks

채택된 답변

José M. Requena Plens
José M. Requena Plens 2021년 3월 16일
Limits cannot be assigned equal.
I would first check the value of 'max (cruiseList)', if it is lower or equal to 1 I would not assign the limits to the spinner. In this case, I would hide it or disable it since it would have no use.
Hiding:
if max(cruiseList)<=1
app.A.Visible = 'off'
app.A.Value = 1;
else
app.A.Limits = [1, max(cruiseList)];
end
Disabling
if max(cruiseList)<=1
app.A.Enable = 'off'
app.A.Value = 1;
else
app.A.Limits = [1, max(cruiseList)];
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by