How to set MATLAB GUI drop down to be empty be default
22 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Zarif Rahman
el 8 de Abr. de 2021
dd = uidropdown(fig,...
'Position',[30 120 200 22],...
'Items',{'bayesian_optimization','opto_configure_gamma_gp_uncertainty_sampling',...
'grid_search1','grid_search3','electrical_stimulation','cross_entropy','pid_controller',...
'bayesian_optimization','bayesian_optimization2','theta_optimization', 'gamma_maximization', ...
'random_nested_pulse_train', 'opto_configure_gamma_gp_uncertainty_sampling'},...
'Editable','on');
This is my drop down code. By default it goes to the first value on the list which is Bayesian Optimization. Can we have it where it defaults to nothing? And is there way to add functionality to that aswell? Like making every button greyed out until that drop down selected.
0 comentarios
Respuesta aceptada
Adam Danz
el 8 de Abr. de 2021
Editada: Adam Danz
el 8 de Abr. de 2021
By default, uidropdown uses the first item as the default item but you can also specify the Value property to display another value.
Here I've specified an empty character array to appear when the uidropdown is rendered.
dd = uidropdown(fig,...
'Position',[30 120 200 22],...
'Items',{'bayesian_optimization','opto_configure_gamma_gp_uncertainty_sampling',...
'grid_search1','grid_search3','electrical_stimulation','cross_entropy','pid_controller',...
'bayesian_optimization','bayesian_optimization2','theta_optimization', 'gamma_maximization', ...
'random_nested_pulse_train', 'opto_configure_gamma_gp_uncertainty_sampling'},...
'Editable','on','Value', ''); % <------ specify value
Use the ValueChangedFcn to control the behavior of app components when there is a selection from the dropdown menu. See examples in the documentation.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Variables en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!