Can I use a list box to choose several alternatives from the listed ones?

2 vues (au cours des 30 derniers jours)
Muazma Ali
Muazma Ali le 24 Fév 2023
Commenté : Muazma Ali le 24 Fév 2023
I am a little confused; from the videos I have seen it seems the list box in matlab app designer functions as a dropdown list just making it possible to choose one single item.
In my case I need to choose a minimum of 2 salts and a maximum of three salts from the list. Is it then possible to use the list box in matlab app desginer or something else is more useful then..?
I am attaching the code that I want to implement or convert in matlab app designer, :)

Réponses (2)

Simon Chan
Simon Chan le 24 Fév 2023
Modifié(e) : Simon Chan le 24 Fév 2023
Turn listbox 'Multiselect' to 'on'
  2 commentaires
Muazma Ali
Muazma Ali le 24 Fév 2023
@Simon Chan It seems I dont have multiselect option in matlab 2018 b, is there any other way I can program my code in app designer so the user can choose several alternatives..?
Muazma Ali
Muazma Ali le 24 Fév 2023
@Simon Chan Forget it I can see I have it here.. :)

Connectez-vous pour commenter.


Cameron
Cameron le 24 Fév 2023
Modifié(e) : Cameron le 24 Fév 2023
You can use a uilistbox and select multiple items using the Multiselect
fig = uifigure('Position',[100 100 350 275]);
% Create List Box
S={'ZnBr2'; 'MgCl2'; 'CaCl2'; 'KCl'; 'MgBr2'; 'NaCl'; 'AlCl3'; 'CH3CO2K';'HCOOK';'HCOONa'; 'CaBr2'};
lbox = uilistbox(fig,...
'Items',S,...
'Position',[125 120 100 78],...
'Multiselect','on');
Or you could make them into drop down values like this
fig = uifigure('Position',[100 100 350 275]);
% Create List Box
S={'ZnBr2'; 'MgCl2'; 'CaCl2'; 'KCl'; 'MgBr2'; 'NaCl'; 'AlCl3'; 'CH3CO2K';'HCOOK';'HCOONa'; 'CaBr2'};
bt1 = uidropdown(fig,...
'Items',[{'None'};S]);
bt2 = uidropdown(fig,...
'Items',S,...
'Position',bt1.Position + [0 22 0 0]);
bt3 = uidropdown(fig,...
'Items',S,...
'Position',bt2.Position + [0 22 0 0]);

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by