필터 지우기
필터 지우기

Can I generate a menu of choices with a dialogue box that allows more than one of the options to be selected?

조회 수: 3 (최근 30일)
I wish to display a menu with country names as the buttons. The idea is that I am running regressions of financial data in different countries, and I wish to be able to have the user interactively choose which countries he/she wants to represent in the data (think EM, EU countries, developed nations...there mnay goruping that would be useful). Ideally, pressing one of the buttons would switch the corresponding element in an array of logicals to true. A button not being pressed would leave the element as false (i would preallocate an array of false's of length equal to the number of countries). This would allow me to inpt this array of logicals into an array of all country names, returning only those names that would be used in the regression. Some code would be more than appreciated, but really I am just hoping to know if this is even possible, and what sort of built in functions besides inputdlg and menu I should look for. Thanks!

채택된 답변

Image Analyst
Image Analyst 2013년 7월 9일
편집: Image Analyst 2013년 7월 9일
Have you considered using the menu() function?
button = menu('Choose a country', 'UK', 'Belgium', 'Italy', 'France' , 'Luxembourg')
Or a bunch of checkboxes or a listbox?
  댓글 수: 1
Andrew Kreitzman
Andrew Kreitzman 2013년 7월 9일
I was under the impression that the menu function would only allow me to choose one country. I stumbled upon listbox last night, and I am trying to find a good example of its use because the mathworks example was a bit unclear to me.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2013년 7월 9일
uicontrol('Style','listbox',...
'Units','normalized',...
'Position',[0.1 0.1 0.3 0.5],...
'String',{'Hello World','Happy Tuesday','One bourbon','One scotch','One beer'},...
'Max',3,... %Increase for multiselect
'Value',1,...
'Callback',[]);
The 'Max' property of a listbox controls multiselect.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by