function varargout = nic_rsdd_idenfifyCompPara(varargin)
% NIC_RSDD_IDENFIFYCOMPPARA M-file for nic_rsdd_idenfifyCompPara.fig
%      NIC_RSDD_IDENFIFYCOMPPARA, by itself, creates a new NIC_RSDD_IDENFIFYCOMPPARA or raises the existing
%      singleton*.
%
%      H = NIC_RSDD_IDENFIFYCOMPPARA returns the handle to a new NIC_RSDD_IDENFIFYCOMPPARA or the handle to
%      the existing singleton*.
%
%      NIC_RSDD_IDENFIFYCOMPPARA('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in NIC_RSDD_IDENFIFYCOMPPARA.M with the given input arguments.
%
%      NIC_RSDD_IDENFIFYCOMPPARA('Property','Value',...) creates a new NIC_RSDD_IDENFIFYCOMPPARA or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before nic_rsdd_idenfifyCompPara_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to nic_rsdd_idenfifyCompPara_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 nic_rsdd_idenfifyCompPara

% Last Modified by GUIDE v2.5 29-Jun-2010 11:52:07

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @nic_rsdd_idenfifyCompPara_OpeningFcn, ...
                   'gui_OutputFcn',  @nic_rsdd_idenfifyCompPara_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 nic_rsdd_idenfifyCompPara is made visible.
function nic_rsdd_idenfifyCompPara_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 nic_rsdd_idenfifyCompPara (see VARARGIN)

% Choose default command line output for nic_rsdd_idenfifyCompPara
handles.output = hObject;

for i=1:length(handles.IdenComCheck)
    set(handles.IdenComCheck(i), 'Value',1);
end
% Update handles structure
guidata(hObject, handles);

% UIWAIT makes nic_rsdd_idenfifyCompPara wait for user response (see UIRESUME)
uiwait(handles.IdentifyCompHdl);


% --- Outputs from this function are returned to the command line.
function varargout = nic_rsdd_idenfifyCompPara_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.selPara;
varargout{2} = handles.output;
closereq();

% --- Executes on button press in IdenComCheck.
function IdenComCheck_Callback(hObject, eventdata, handles)
% hObject    handle to IdenComCheck (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 IdenComCheck
values=get(handles.IdenComCheck,'Value');
if(values{2}==1)
    set(handles.CommClusteringRatio,'Enable','on');
else
    set(handles.CommClusteringRatio,'Enable','off');
end
if(values{3}==1)
    set(handles.CommSpectRatio,'Enable','on');
    set(handles.EditSpectThre,'Enable','on');
else
    set(handles.CommSpectRatio,'Enable','off');
    set(handles.EditSpectThre,'Enable','off');
end


% --- Executes on selection change in CommClusteringRatio.
function CommClusteringRatio_Callback(hObject, eventdata, handles)
% hObject    handle to CommClusteringRatio (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns CommClusteringRatio contents as cell array
%        contents{get(hObject,'Value')} returns selected item from CommClusteringRatio


% --- Executes during object creation, after setting all properties.
function CommClusteringRatio_CreateFcn(hObject, eventdata, handles)
% hObject    handle to CommClusteringRatio (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on selection change in CommSpectRatio.
function CommSpectRatio_Callback(hObject, eventdata, handles)
% hObject    handle to CommSpectRatio (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns CommSpectRatio contents as cell array
%        contents{get(hObject,'Value')} returns selected item from CommSpectRatio
selvalue=get(hObject,'Value');
if(selvalue==5)
    set(handles.EditSpectThre,'Visible','on');
else
    set(handles.EditSpectThre,'Visible','off');    
end


% --- Executes during object creation, after setting all properties.
function CommSpectRatio_CreateFcn(hObject, eventdata, handles)
% hObject    handle to CommSpectRatio (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function EditSpectThre_Callback(hObject, eventdata, handles)
% hObject    handle to EditSpectThre (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of EditSpectThre as text
%        str2double(get(hObject,'String')) returns contents of EditSpectThre as a double


% --- Executes during object creation, after setting all properties.
function EditSpectThre_CreateFcn(hObject, eventdata, handles)
% hObject    handle to EditSpectThre (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in ButtSetOK.
function ButtSetOK_Callback(hObject, eventdata, handles)
% hObject    handle to ButtSetOK (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
a=get(handles.IdenComCheck,'Value');
contents = get(handles.CommClusteringRatio,'String');
para.clusterPara=str2num(contents{get(handles.CommClusteringRatio,'Value')});

% clusterP=get(handles.CommClusteringRatio,'Value');

contents = get(handles.CommSpectRatio,'String');

para.freqPara=str2num(contents{get(handles.CommSpectRatio,'Value')});

para.freqOption=get(handles.CommSpectRatio,'Value');


freThre=str2num(get(handles.EditSpectThre,'String'));


para.IdenCompOption=a;
% para.clusterPara=clusterP;

para.freThre=freThre;


handles.selPara=para;

guidata(hObject,handles);
% delete(get(0, 'children'));
% closereq();
uiresume(handles.IdentifyCompHdl);






