MATLAB Answers

How can i create multiple choice questions GUI using Guide ?

83 ビュー (過去 30 日間)
Prashanth Damojipurapu
Prashanth Damojipurapu 2016 年 7 月 5 日
I need to create a GUI with Multiple Choice Questions
There will be 15 questions, four choices for each question,push button to submit the answer and there will be 15 stars. if the user selects a correct answer the star becomes green,if not star will turn to red.
I need to know which choice the user has selected ?
I attached an snapshot of how i did it.
I tried to insert the stars but it didn't seem to work.
Hope somebody can help me. Thanks in advance.

  2 件のコメント

Prashanth Damojipurapu
Prashanth Damojipurapu 2016 年 7 月 6 日
How can we add 15 questions in GUI ?
what about the star indications ? can you help me with that ?
Geoff Hayes
Geoff Hayes 2016 年 7 月 6 日
I think that you would have a Next button to go from one question to the next. In the callback for this button, you would need to update the question and answers for that next question.
As for the star, you mentioned I tried to insert the stars but it didn't seem to work. What did you do? Do you have a green star image and a red one?

サインイン to comment.

回答 (3 件)

Image Analyst
Image Analyst 2016 年 7 月 7 日
The best way to have 15 questions, if you don't want to take up your whole screen, is to use a popup control (a drop down list).
Alternatives would be a listbox control,
or calling the menu() function to popup a dialog box but that only lets them interact when you call the function, not whenever they want like a control.
Again, I recommend the popup control as the best option for letting the user choose from a list of 15 options.

  4 件のコメント

表示 1 件の古いコメント
Image Analyst
Image Analyst 2016 年 7 月 7 日
No. Making the user slide a slider (scrollbar) and then telling them what option they "are on" via a static text label would be a horrible, user-hostile way of letting a user pick from a set of options.
Prashanth Damojipurapu
Prashanth Damojipurapu 2016 年 7 月 7 日
Okay.
Image Analyst
Image Analyst 2016 年 7 月 7 日
If you want to let them pick from a continuum of values, then a scrollbar would be okay, like "How much do you like this product on a scale of 0 to 10?" But it would not be good for a discrete set of choices.

サインイン to comment.


Geoff Hayes
Geoff Hayes 2016 年 7 月 5 日
Prashanth - if your radio buttons have been created within a uipanel (which given your screenshot appears to be the case) then you can get the selected radio button from within the pushbutton callback as
function pushbutton1_Callback(hObject, eventdata, handles)
hSelectedRadioBtn = get(handles.uipanel1,'SelectedObject')
The above assumes that the Tag property for your panel has been set to uipanel1. Once you have the handle to the radio button, you can check its string to see what answer the user has selected.

  1 件のコメント

Prashanth Damojipurapu
Prashanth Damojipurapu 2016 年 7 月 5 日
Thanks for the Answer Geoff Hayes.

サインイン to comment.


Shameer Parmar
Shameer Parmar 2016 年 7 月 7 日
Hello Prashanth,
Check the attached scripts..
Run the Test.m file and see the results..
Go through the logic added into callback of functions...Let me know if you dont get the logic..

  7 件のコメント

表示 4 件の古いコメント
Shameer Parmar
Shameer Parmar 2016 年 7 月 20 日
Prashanth,
Please find attached updated Question format..
Prashanth Damojipurapu
Prashanth Damojipurapu 2016 年 7 月 27 日
Thank you.
Prashanth Damojipurapu
Prashanth Damojipurapu 2016 年 8 月 2 日
I got a small error while running the file. In my files i included a previous button. Score is being counted twice,if the user goes previous question selects the correct choice and goes to the next question.
I need to change the code but i don't know how.
Can you help me that ??

サインイン to comment.

サインイン してこの質問に回答します。


Translated by