Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to take additional inputs from user after selecting an option from popup menu?

조회 수: 1 (최근 30일)
adi kul
adi kul 2016년 5월 31일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello All, I am working in building a GUI from my script. Now I am at the point where I need guidance in popup menu of the GUI.
I have 4 different values for popup menu and I am trying to get additional inputs from user.
So suppose the values in my popup menu are:
--Select a combination--
Combination1
Combination2
Combination3
So now what I want is, initially the GUI will show --Select a combination-- as popup value. Now when user clicks on the drop down and select combination 1, a new window should open to get additional inputs required. Like wise if he selects combination2 while combination1 window is open, the combination1 window should close and combination2 window should open.
I hope I have explained it correctly.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 5월 31일
selection = get(hObject, 'Value');
switch selection
case 1: do_work_for_combination1(handles);
case 2: do_work_for_combination2(handles);
case 3: do_work_for_combination3(handles);
end
  댓글 수: 1
adi kul
adi kul 2016년 5월 31일
Hello, Thank you for the suggestions. I found this :http://in.mathworks.com/help/matlab/ref/inputdlg.html
I want to use this to get the additional inputs but I am not sure how to retrieve those inputs,
Here is my code:
selection = get(hObject, 'Value');
switch selection
case 1
h=msgbox('Please select the Combination');
case 2
te1=0;
case 3
te1=1;
prompt = {'enter the radius of the sphere (mm)','enter the x coordinate of the sphere mid-point','enter the y coordinate of the sphere mid-point'};
dlg_title = 'Sphere';
num_lines = 1;
defaultans = {'','0','0'};
answer = inputdlg(prompt,dlg_title,num_lines,defaultans);
end
Now I want to retrieve the values given by users and assign them to the variables x,y & z.
Can you help me on how to get those values?

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by