Check boxes allow the user to select multiple options, pop-up menus display a list of commands for the user to select from, and list boxes let the user pick a single item from a static multiple line list. The document also provides sample MATLAB code callbacks for check boxes, pop-up menus, and list boxes that output simple messages based on the user's selections. It concludes with questions about designing GUIs using list boxes to select values and calculate a volume or factorial.
Check boxes allow the user to select multiple options, pop-up menus display a list of commands for the user to select from, and list boxes let the user pick a single item from a static multiple line list. The document also provides sample MATLAB code callbacks for check boxes, pop-up menus, and list boxes that output simple messages based on the user's selections. It concludes with questions about designing GUIs using list boxes to select values and calculate a volume or factorial.
Check boxes allow the user to select multiple options, pop-up menus display a list of commands for the user to select from, and list boxes let the user pick a single item from a static multiple line list. The document also provides sample MATLAB code callbacks for check boxes, pop-up menus, and list boxes that output simple messages based on the user's selections. It concludes with questions about designing GUIs using list boxes to select values and calculate a volume or factorial.
end POPUP MENUE the pop-up contains a menu of commands and stays on the screen, screen appears with a list of menu items from which to select.
function p1_Callback(hObject, eventdata, handles)
%hObject handle to p1 (see GCBO) %Hints: contents = cellstr(get(hObject,'String')) returns p1 contents as cell array %contents{get(hObject,'Value')}return selected item from p1 c = cellstr(get(hObject,'String')); switch get(hObject,'value') case 1 msgbox ([c(1) '=1']); case 2 msgbox ([c(2) '=2']); case 3 msgbox ([c(3) '=3']); end LIST BOX List box allows the user to select one item from a list contained within a static, multiple line text box. The user clicks inside the box on an item to select it.
function listbox1_Callback(hObject, eventdata, handles)
% hObject handle to listbox1 % contents = cellstr(get(hObject,'String')) returns listbox1 contents as cell array % get(hObject,'Value')returns selected item from listbox1 c = cellstr(get(hObject,'String')); switch get(hObject,'Value') case 1 msgbox([ 'hello ' c(1)]); case 2 msgbox([ 'hello ' c(2)]); case 3 msgbox([ 'hello ' c(3)]); end Q1: Design GUI to select width from list box and select length from 2nd list box then show the volume.
Q2: Design GUI to select Number from 2:10 from list box then show its factorial.