Limits of app-designer spinner input field

12 ビュー (過去 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
  1 件のコメント
Leon
Leon 2021 年 3 月 16 日
Many thanks for the solutions!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop 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