Solved, you can close the 3d. For those interested, it was quite easy: simply add or update a "handles" variabile field by making the choice and saving it with guidata.
Sequential Button Group in GUI
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi, i got this problem. I'm trying to make a GUI with several button groups with multiple choices, like Action1: Radiobutton 1 to 9, Action 2: Radiobutton 1 to 6 and so on. The main idea is that the user make different choice, what's chosen goes to a switch case with a value, when all the choices are taken they go into a function by a push button which return a text. The problem is that when i make every step of each button group by selectionchangefcn, when i pass to other groups previous choices gone lost and i cant input the final evaluating function under the push button callback. Any solution? Maybe the code could help:
if true
% code
end
% function varargout = Holdem_PFD_04_12(varargin)
% % HOLDEM_PFD_04_12 M-file for Holdem_PFD_04_12.fig
% % HOLDEM_PFD_04_12, by itself, creates a new HOLDEM_PFD_04_12 or raises the existing
% % singleton*.
% %
% % H = HOLDEM_PFD_04_12 returns the handle to a new HOLDEM_PFD_04_12 or the handle to
% % the existing singleton*.
% %
% % HOLDEM_PFD_04_12('CALLBACK',hObject,eventData,handles,...) calls the local
% % function named CALLBACK in HOLDEM_PFD_04_12.M with the given input arguments.
% %
% % HOLDEM_PFD_04_12('Property','Value',...) creates a new HOLDEM_PFD_04_12 or raises the
% % existing singleton*. Starting from the left, property value pairs are
% % applied to the GUI before Holdem_PFD_04_12_OpeningFcn gets called. An
% % unrecognized property name or invalid value makes property application
% % stop. All inputs are passed to Holdem_PFD_04_12_OpeningFcn via varargin.
% %
% % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% % instance to run (singleton)".
% %
% % See also: GUIDE, GUIDATA, GUIHANDLES
%
% % Edit the above text to modify the response to help Holdem_PFD_04_12
%
% % Last Modified by GUIDE v2.5 05-Dec-2013 10:57:46
%
% % Begin initialization code - DO NOT EDIT
% gui_Singleton = 1;
% gui_State = struct('gui_Name', mfilename, ...
% 'gui_Singleton', gui_Singleton, ...
% 'gui_OpeningFcn', @Holdem_PFD_04_12_OpeningFcn, ...
% 'gui_OutputFcn', @Holdem_PFD_04_12_OutputFcn, ...
% 'gui_LayoutFcn', [] , ...
% 'gui_Callback', []);
% if nargin && ischar(varargin{1})
% gui_State.gui_Callback = str2func(varargin{1});
% end
%
% if nargout
% [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
% else
% gui_mainfcn(gui_State, varargin{:});
% end
% % End initialization code - DO NOT EDIT
%
%
% % --- Executes just before Holdem_PFD_04_12 is made visible.
% function Holdem_PFD_04_12_OpeningFcn(hObject, eventdata, handles, varargin)
% % This function has no output args, see OutputFcn.
% % hObject handle to figure
% % eventdata reserved - to be defined in a future version of MATLAB
% % handles structure with handles and user data (see GUIDATA)
% % varargin command line arguments to Holdem_PFD_04_12 (see VARARGIN)
%
% % Choose default command line output for Holdem_PFD_04_12
% handles.output = hObject;
%
% % Update handles structure
% guidata(hObject, handles);
%
% % UIWAIT makes Holdem_PFD_04_12 wait for user response (see UIRESUME)
% % uiwait(handles.figure1);
%
%
% % --- Outputs from this function are returned to the command line.
% function varargout = Holdem_PFD_04_12_OutputFcn(hObject, eventdata, handles)
% % varargout cell array for returning output args (see VARARGOUT);
% % hObject handle to figure
% % eventdata reserved - to be defined in a future version of MATLAB
% % handles structure with handles and user data (see GUIDATA)
%
% % Get default command line output from handles structure
% varargout{1} = handles.output;
%
%
%
%
%
% % --- Executes when selected object is changed in uipanel1.
% function uipanel1_SelectionChangeFcn(hObject, eventdata, handles)
% % hObject handle to the selected object in uipanel1
% % eventdata structure with the following fields (see UIBUTTONGROUP)
% % EventName: string 'SelectionChanged' (read only)
% % OldValue: handle of the previously selected object or empty if none was selected
% % NewValue: handle of the currently selected object
% % handles structure with handles and user data (see GUIDATA)
% value=get(eventdata.NewValue, 'Tag');
% switch value
% case 'radiobutton1' % TpTk
% value='tptk';
% uipanel5_SelectionChangeFcn(hObject, eventdata, handles,value)
% case 'radiobutton2' % TpGk
% value='tpgk';
% uipanel5_SelectionChangeFcn(hObject, eventdata, handles,value)
%
% case 'radiobutton3' % 2p
% value='2p';
% uipanel5_SelectionChangeFcn(hObject, eventdata, handles,value)
%
% case 'radiobutton4' % Op
% value='op';
%
% case 'radiobutton5' % Trips
% value='trips';
%
% case 'radiobutton6' % Set
% value='set';
%
% case 'radiobutton7' % Mid value
% value='midv';
%
% case 'radiobutton8' % Missed
% value='mis';
%
% case 'radiobutton9' % Straight
% value='str8';
%
% case 'radiobutton10' % Flush
% value='flush';
%
% case 'radiobutton11' % Flush draw
% value='fd';
%
% end
%
%
% % --- Executes when selected object is changed in uipanel5.
% function uipanel5_SelectionChangeFcn(hObject, eventdata, handles,value)
% % hObject handle to the selected object in uipanel5
% % eventdata structure with the following fields (see UIBUTTONGROUP)
% % EventName: string 'SelectionChanged' (read only)
% % OldValue: handle of the previously selected object or empty if none was selected
% % NewValue: handle of the currently selected object
% % handles structure with handles and user data (see GUIDATA)
% action=get(eventdata.NewValue, 'Tag');
% switch action
% case 'radiobutton1' % Raisato nostro
% action='rn';
%
% case 'radiobutton2' % Raisato oppo
% action='ro';
%
% case 'radiobutton3' % 3bettato nostro
% action='3bn';
%
% case 'radiobutton4' % 3bettato oppo
% action='3bo';
% uipanel6_SelectionChangeFcn(hObject, eventdata, handles,value, action)
%
% case 'radiobutton5' % Nbettato nostro
% action='Nbn';
%
% case 'radiobutton6' % Nebettato oppo
% action='Nbo';
% end
%
% % --- Executes when selected object is changed in uipanel6.
% function uipanel6_SelectionChangeFcn(hObject, eventdata, handles,value, action)
% % hObject handle to the selected object in uipanel6
% % eventdata structure with the following fields (see UIBUTTONGROUP)
% % EventName: string 'SelectionChanged' (read only)
% % OldValue: handle of the previously selected object or empty if none was selected
% % NewValue: handle of the currently selected object
% % handles structure with handles and user data (see GUIDATA)
% texture=get(eventdata.NewValue, 'Tag');
% switch texture
% case 'radiobutton1' % Fd/monotone
% texture='fd';
%
% case 'radiobutton2' % Straight draw
% texture='oesd';
% uipanel7_SelectionChangeFcn(hObject, eventdata, handles,value, action, texture)
%
% case 'radiobutton3' % Paired
% texture='paired';
%
% case 'radiobutton4' % Broadway+low card
% texture='br+lc';
%
% case 'radiobutton5' % Broadwway+high card
% texture='br+c';
%
% case 'radiobutton6' % Rainbow
% texture='rainbow';
%
% end
%
%
%
% % --- Executes when selected object is changed in uipanel7.
% function uipanel7_SelectionChangeFcn(hObject, eventdata, handles,value, action, texture)
% % hObject handle to the selected object in uipanel7
% % eventdata structure with the following fields (see UIBUTTONGROUP)
% % EventName: string 'SelectionChanged' (read only)
% % OldValue: handle of the previously selected object or empty if none was selected
% % NewValue: handle of the currently selected object
% % handles structure with handles and user data (see GUIDATA)
% pos=get(eventdata.NewValue, 'Tag');
% switch pos
% case 'radiobutton1' % IP
% pos='ip';
% uipanel8_SelectionChangeFcn(hObject, eventdata, handles, value, action, texture, pos)
%
% case 'radiobutton2' % OOP
% pos='oop';
%
% end
%
%
% % --- Executes when selected object is changed in uipanel8.
% function uipanel8_SelectionChangeFcn(hObject, eventdata, handles, value, action, texture, pos)
% % hObject handle to the selected object in uipanel8
% % eventdata structure with the following fields (see UIBUTTONGROUP)
% % EventName: string 'SelectionChanged' (read only)
% % OldValue: handle of the previously selected object or empty if none was selected
% % NewValue: handle of the currently selected object
% % handles structure with handles and user data (see GUIDATA)
% num=get(eventdata.NewValue, 'Tag');
% switch num
% case 'radiobutton1' % HU
% opponumber='hu';
% uipanel9_SelectionChangeFcn(hObject, eventdata, handles,value, action, texture, pos,num)
% case 'radiobutton2' % Multiway
% opponumber='multiway';
%
% end
%
% % --- Executes when selected object is changed in uipanel9.
% function uipanel9_SelectionChangeFcn(hObject, eventdata, handles,value, action, texture, pos,num)
% % hObject handle to the selected object in uipanel9
% % eventdata structure with the following fields (see UIBUTTONGROUP)
% % EventName: string 'SelectionChanged' (read only)
% % OldValue: handle of the previously selected object or empty if none was selected
% % NewValue: handle of the currently selected object
% % handles structure with handles and user data (see GUIDATA)
% bbs=get(eventdata.NewValue, 'Tag');
% switch bbs
% case 'radiobutton1' % 15-25 bb
% bb=15;
% pushbutton1_Callback(hObject, eventdata, handles,value, action, texture, pos,num,bb)
% case 'radiobutton2' % 25-35 bb
% bb=15;
% pushbutton1_Callback(hObject, eventdata, handles,value, action, texture, pos,num,bb)
% case 'radiobutton3' % 35+ bb
% bb=35;
% pushbutton1_Callback(hObject, eventdata, handles,value, action, texture, pos,num,bb)
%
% end
% % evaluation= Holdem_Postflop_Decision_Tree(value, action,texture, pos, opponumber,bb);
%
% % --- If Enable == 'on', executes on mouse press in 5 pixel border.
% % --- Otherwise, executes on mouse press in 5 pixel border or over edit1.
% function edit1_ButtonDownFcn(hObject, eventdata, handles)
% % hObject handle to edit1 (see GCBO)
% % eventdata reserved - to be defined in a future version of MATLAB
% % handles structure with handles and user data (see GUIDATA)
%
%
% % --- Executes on button press in pushbutton1.
% function pushbutton1_Callback(hObject, eventdata, handles,value, action, texture, pos,num,bb)
% % hObject handle to pushbutton1 (see GCBO)
% % eventdata reserved - to be defined in a future version of MATLAB
% % handles structure with handles and user data (see GUIDATA)
% evaluation= Holdem_Postflop_Decision_Tree(value, action,texture, pos, opponumber,bb);
% set(handles.text2,'String',evaluation)
%
% % --- If Enable == 'on', executes on mouse press in 5 pixel border.
% % --- Otherwise, executes on mouse press in 5 pixel border or over pushbutton1.
% function pushbutton1_ButtonDownFcn(hObject, eventdata, handles)
% % hObject handle to pushbutton1 (see GCBO)
% % eventdata reserved - to be defined in a future version of MATLAB
% % handles structure with handles and user data (see GUIDATA)
%
%
% % --- If Enable == 'on', executes on mouse press in 5 pixel border.
% % --- Otherwise, executes on mouse press in 5 pixel border or over text2.
% function text2_ButtonDownFcn(hObject, eventdata, handles)
% % hObject handle to text2 (see GCBO)
% % eventdata reserved - to be defined in a future version of MATLAB
% % handles structure with handles and user data (see GUIDATA)
%
%
댓글 수: 0
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Object Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!