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

% Last Modified by GUIDE v2.5 25-Nov-2018 22:58:57

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

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

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes SettingsGUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = SettingsGUI_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 selection change in edit1.
function edit1_Callback(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)

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


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

% Hint: listbox 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 BaudEnter_Callback(hObject, eventdata, handles)
% hObject    handle to BaudEnter (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 BaudEnter as text
%        str2double(get(hObject,'String')) returns contents of BaudEnter as a double


% --- Executes during object creation, after setting all properties.
function BaudEnter_CreateFcn(hObject, eventdata, handles)
% hObject    handle to BaudEnter (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


function FolderEnter_Callback(hObject, eventdata, handles)
% hObject    handle to FolderEnter (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 FolderEnter as text
%        str2double(get(hObject,'String')) returns contents of FolderEnter as a double


% --- Executes during object creation, after setting all properties.
function FolderEnter_CreateFcn(hObject, eventdata, handles)
% hObject    handle to FolderEnter (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



function PrefixEnter_Callback(hObject, eventdata, handles)
% hObject    handle to PrefixEnter (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 PrefixEnter as text
%        str2double(get(hObject,'String')) returns contents of PrefixEnter as a double


% --- Executes during object creation, after setting all properties.
function PrefixEnter_CreateFcn(hObject, eventdata, handles)
% hObject    handle to PrefixEnter (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 selection change in listbox1.
function listbox1_Callback(hObject, eventdata, handles)
% hObject    handle to listbox1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

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


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

% Hint: listbox 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 Comportpop.
function Comportpop_Callback(hObject, eventdata, handles)
% hObject    handle to Comportpop (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

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


% --- Executes during object creation, after setting all properties.
function Comportpop_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Comportpop (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
%set


% --- Executes on button press in StartBtn.
function StartBtn_Callback(hObject, eventdata, handles)
% hObject    handle to StartBtn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
run C:\Users\Abhishek\Documents\MATLAB\FrontGUI.m
%run C:\Users\Abhishek\Documents\MATLAB\iii.m

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

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


% --- Executes during object creation, after setting all properties.
function Datepop_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Datepop (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 Timepop.
function Timepop_Callback(hObject, eventdata, handles)
% hObject    handle to Timepop (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

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


% --- Executes during object creation, after setting all properties.
function Timepop_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Timepop (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 LogFreqEnter_Callback(hObject, eventdata, handles)
% hObject    handle to LogFreqEnter (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 LogFreqEnter as text
%        str2double(get(hObject,'String')) returns contents of LogFreqEnter as a double


% --- Executes during object creation, after setting all properties.
function LogFreqEnter_CreateFcn(hObject, eventdata, handles)
% hObject    handle to LogFreqEnter (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



function SampperlogEnter_Callback(hObject, eventdata, handles)
% hObject    handle to SampperlogEnter (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 SampperlogEnter as text
%        str2double(get(hObject,'String')) returns contents of SampperlogEnter as a double


% --- Executes during object creation, after setting all properties.
function SampperlogEnter_CreateFcn(hObject, eventdata, handles)
% hObject    handle to SampperlogEnter (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 DefBtn2.
function DefBtn2_Callback(hObject, eventdata, handles)
% hObject    handle to DefBtn2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(handles.FolderEnter,'String','C:\Users\Abhishek\Desktop\project\csv\');
set(handles.PrefixEnter,'String','Data at');
set(handles.Datepop,'Value',1)
set(handles.Timepop,'Value',1)
set(handles.SampperlogEnter,'String',1);
set(handles.LogFreqEnter,'String',1);


% --- Executes on button press in SaveBtn2.
function SaveBtn2_Callback(hObject, eventdata, handles)
% hObject    handle to SaveBtn2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
LogFreq=str2double(get(handles.LogFreqEnter,'String'));
%assignin('base','LogFreq',LogFreq);
setappdata(0,'LogFreq',LogFreq);
samplog=str2double(get(handles.SampperlogEnter,'String'));
%assignin('base','samplog',samplog);
setappdata(0,'samplog',samplog);
FolderDest=(get(handles.FolderEnter,'String'));
%assignin('base','FolderDest',FolderDest);
setappdata(0,'FolderDest',FolderDest);
PrefixName=(get(handles.PrefixEnter,'String'));
%assignin('base','PrefixName',PrefixName);
setappdata(0,'PrefixName',PrefixName);
Datecont=cellstr(get(handles.Datepop,'String'));
DateFormat=Datecont{get(handles.Datepop,'Value')};
%assignin('base','DateFormat',DateFormat);
setappdata(0,'DateFormat',DateFormat);
Timecont=cellstr(get(handles.Timepop,'String'));
TimeFormat=Timecont{get(handles.Timepop,'Value')};
%assignin('base','TimeFormat',TimeFormat);
setappdata(0,'TimeFormat',TimeFormat);




% --- Executes on button press in DefBtn1.
function DefBtn1_Callback(hObject, eventdata, handles)
% hObject    handle to DefBtn1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

set(handles.BaudEnter,'String',9600);
%set(handles.Comportpop,'String',COM3);
set(handles.Comportpop,'Value',3)


% --- Executes on button press in SaveBtn1.
function SaveBtn1_Callback(hObject, eventdata, handles)
% hObject    handle to SaveBtn1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
BaudVal=str2double(get(handles.BaudEnter,'String'));
%assignin('base','BaudVal',BaudVal);
setappdata(0,'BaudVal',BaudVal);
compopcont=cellstr(get(handles.Comportpop,'String'));
compopval=compopcont{get(handles.Comportpop,'Value')};
%assignin('base','compopval',compopval);
setappdata(0,'compopval',compopval);

