MATLAB Answers

0

Radio button panel prblm

Asked by satendra kumar on 10 Nov 2012
I have a radio button group. In that one button is automatically selected. I want nothing should be selected. How can i do that thanks

  3 Comments

Jan
on 10 Nov 2012
Please post some relevant code. Did you create the group of radio buttons manually, did you use btngroup or are you working with GUIDE? We cannot and should not guess the details.
if true
function varargout = Least_Sqaure_Optimization(varargin)
% LEAST_SQAURE_OPTIMIZATION M-file for Least_Sqaure_Optimization.fig
% LEAST_SQAURE_OPTIMIZATION, by itself, creates a new LEAST_SQAURE_OPTIMIZATION or raises the existing
% singleton*.
%
% H = LEAST_SQAURE_OPTIMIZATION returns the handle to a new LEAST_SQAURE_OPTIMIZATION or the handle to
% the existing singleton*.
%
% LEAST_SQAURE_OPTIMIZATION('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in LEAST_SQAURE_OPTIMIZATION.M with the given input arguments.
%
% LEAST_SQAURE_OPTIMIZATION('Property','Value',...) creates a new LEAST_SQAURE_OPTIMIZATION or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Least_Sqaure_Optimization_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Least_Sqaure_Optimization_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 Least_Sqaure_Optimization
% Last Modified by GUIDE v2.5 07-Nov-2012 23:39:19
% Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @Least_Sqaure_Optimization_OpeningFcn, ... 'gui_OutputFcn', @Least_Sqaure_Optimization_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 Least_Sqaure_Optimization is made visible. function Least_Sqaure_Optimization_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 Least_Sqaure_Optimization (see VARARGIN)
% Choose default command line output for Least_Sqaure_Optimization handles.output = hObject;
% Update handles structure guidata(hObject, handles);
% UIWAIT makes Least_Sqaure_Optimization wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. function varargout = Least_Sqaure_Optimization_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 on button press in planingtooldata. function planingtooldata_Callback(hObject, eventdata, handles) % hObject handle to planingtooldata (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
planingtooldata= getappdata(0,'planingtooldata');%Import data [a b]=xlsread('2. Planing Tool data.xls'); % has all the numerical data % % b has all the other stuff. % Hint: get(hObject,'Value') returns toggle state of planingtooldata
% --- Executes on button press in internalcomputeddata. function internalcomputeddata_Callback(hObject, eventdata, handles) Internal_Prediction_Calculation_V2
% --- Executes on button press in optimizeslope. function optimizeslope_Callback(hObject, eventdata, handles) % hObject handle to optimizeslope (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of optimizeslope
% --- Executes on button press in optimizeintercept. function optimizeintercept_Callback(hObject, eventdata, handles) % hObject handle to optimizeintercept (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of optimizeintercept
% --- Executes on button press in obstructed. function obstructed_Callback(hObject, eventdata, handles) % hObject handle to obstructed (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %obstructed= getappdata(0,'planingtooldata')
% a=getappdata(0,'planingtooldata'); % l=length(a); % j=1; % figure; % for i=1:l % if(a(i,9)~=0) % n=a(i,:); % % % end % end %InterceptSlopeDLPMO_Obstructed % set(handles.obstructed,'value',0);
% Hint: get(hObject,'Value') returns toggle state of obstructed
% --- Executes on button press in nonobstructed. function nonobstructed_Callback(hObject, eventdata, handles) % hObject handle to nonobstructed (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % a=getappdata(0,'planingtooldata'); % l=length(a); % j=1; % figure; % for i=1:l % if(a(i,9)==0) % n=a(i,:); % % hold on % end % end %Call algo % InterceptSlopeDLPMO_Non_Obstructed % set(handles.nonobstructed,'value',0);
%DATA SORTING
% Hint: get(hObject,'Value') returns toggle state of nonobstructed
% --- Executes on button press in both. function both_Callback(hObject, eventdata, handles) % hObject handle to both (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of both
% --- Executes on button press in optimize. function optimize_Callback(hObject, eventdata, handles) % hObject handle to optimize (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) uipanel4_SelectionChangeFcn(hObject, eventdata, handles)
function uibuttongroup1_SelectionChangeFcn(hObject,eventdata) switch get(eventdata.NewValue,'Tag') % Get Tag of selected object. case 'obstructedP' % Code for when radiobutton1 is selected. case 'nonobstructed' InterceptSlopeDLPMO_Non_Obstructed % Code for when radiobutton2 is selected. otherwise % Code for when there is no match.
end
% --- Executes on button press in cancel. function cancel_Callback(hObject, eventdata, handles) % hObject handle to cancel (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% -------------------------------------------------------------------- function uipanel3_ButtonDownFcn(hObject, eventdata, handles) % hObject handle to uipanel3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% --- Executes when selected object is changed in uipanel4. function uipanel4_SelectionChangeFcn(hObject, eventdata, handles) if hObject==handles.obstructed
%Progress bar h = progressbar( [],0,'Loading Files...' ); max_count = 1e+3; for idx = 1:max_count fprintf( '%d\n',idx )'; h = progressbar( h,1/max_count ); if ~gui_active break; end end progressbar( h,-1 );
%CALL SCRIPT FOR OBSTRUCTED CASE InterceptSlopeDLPMO_Obstructed
%CALL SCRIPT FOR NON-OBSTRUCTED CASE elseif hObject==handles.nonobstructed InterceptSlopeDLPMO_Non_Obstructed_new
elseif hObject==handles.both InterceptSlopeDLPMO_Non_Obstructed_new %suffix no for non-obsturcted err_no=getappdata(0,'error') errstdev_no=getappdata(0,'errstdev') prednew_no=getappdata(0,'PredNew') predicted_no=getappdata(0,'predicted') measured_no=getappdata(0,'measured') site_no=getappdata(0,'site');
InterceptSlopeDLPMO_Obstructed
err_o=getappdata(0,'error');
errstdev_o=getappdata(0,'errstdev');
prednew_o=getappdata(0,'PredNew');
predicted_o=getappdata(0,'predicted');
measured_o=getappdata(0,'measured');
site_o=getappdata(0,'site');
%F=Final Results err=[err_no;err_o]; errstdev=[errstdev_no;errstdev_o]; prednew=[prednew_no;prednew_o]; predicted=[predicted_no;predicted_o]; measured=[measured_no;measured_o]; disp('Error for both cases') err_f=err_no+err
%Result of BOTH case plotting %Ploting figure; plot(prednew,'b') hold on plot(predicted,'g') hold on plot(measured,'r') legend('PredNew', 'Predicted','Measured')
end
end
Azzi Abdelmalek
on 10 Nov 2012
Simon, just asked to give more precision, not all this

Sign in to comment.

2 Answers

Matt Fig
Answer by Matt Fig
on 10 Nov 2012
Edited by Matt Fig
on 10 Nov 2012
 Accepted Answer

In your Least_Sqaure_Optimization_OpeningFcn put this:
set(handles.uipanel1,'SelectedObject',[])
Where uipanel1 is the name of the buttongroup. If you don't know the required name, first open your GUI then do this:
H = findall(0,'type','uipanel')
get(H,'tag') % The name is in here..

  1 Comment

worked :) thanks

Sign in to comment.


Azzi Abdelmalek
Answer by Azzi Abdelmalek
on 10 Nov 2012

set(handles.radiobutton1,'value',0)

  0 Comments

Sign in to comment.