function varargout = Main_panel(varargin)

%%%Dr. Ignacio Serrano-Pedraza 2018
%%%iserrano@ucm.es

%%This is the Main Panel that opens all the programs of the teaching
%%project. 



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

% Last Modified by GUIDE v2.5 14-Mar-2018 13:06:48

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

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

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = Main_panel_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 Pure_Tones.
function Open_programs_Callback(hObject, eventdata, handles,program)


if program==1
Puretones;     
end
if program==2
Noisesound;     
end
if program==3
Complexsounds;     
end
if program==4
Maskingsounds;     
end
if program==5
Spectrogram_sounds;     
end
if program==6
Gabor_patch;     
end
if program==7
Fourier_demo;     
end
if program==8
Filtered_images;     
end
if program==9
Masking_images;     
end
if program==10
Visual_system;     
end
if program==11
Stimuli_3D;     
end
if program==12
SDT_SP1;     
end

% --- Executes during object creation, after setting all properties.
function Pure_Tones_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Pure_Tones (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(hObject, 'String', {'Select the function', 'Pure tone','Noise sounds','Complex sounds','Masking', 'Filteringsounds' });



% --- Executes on button press in Pure_tone.
function Pure_tone_Callback(hObject, eventdata, handles)
% hObject    handle to Pure_tone (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
program=1;
Open_programs_Callback(hObject, eventdata, handles, program)


% --- Executes on button press in Noisesound.
function Noisesound_Callback(hObject, eventdata, handles)
% hObject    handle to Noisesound (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
program=2;
Open_programs_Callback(hObject, eventdata, handles, program)


% --- Executes on button press in complexsounds.
function complexsounds_Callback(hObject, eventdata, handles)
% hObject    handle to complexsounds (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
program=3;
Open_programs_Callback(hObject, eventdata, handles, program)


% --- Executes on button press in maskingsounds.
function maskingsounds_Callback(hObject, eventdata, handles)
% hObject    handle to maskingsounds (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
program=4;
Open_programs_Callback(hObject, eventdata, handles, program)


% --- Executes on button press in spectrogramdemo.
function spectrogramdemo_Callback(hObject, eventdata, handles)
% hObject    handle to spectrogramdemo (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
program=5;
Open_programs_Callback(hObject, eventdata, handles, program)


% --- Executes on button press in gaborpatch.
function gaborpatch_Callback(hObject, eventdata, handles)
% hObject    handle to gaborpatch (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
program=6;
Open_programs_Callback(hObject, eventdata, handles, program)


% --- Executes on button press in fourierdemo.
function fourierdemo_Callback(hObject, eventdata, handles)
% hObject    handle to fourierdemo (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
program=7;
Open_programs_Callback(hObject, eventdata, handles, program)


% --- Executes on button press in filteredimages.
function filteredimages_Callback(hObject, eventdata, handles)
% hObject    handle to filteredimages (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
program=8;
Open_programs_Callback(hObject, eventdata, handles, program)


% --- Executes on button press in pushbutton11.
function pushbutton11_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton11 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
program=9;
Open_programs_Callback(hObject, eventdata, handles, program)


% --- Executes on button press in pushbutton12.
function pushbutton12_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton12 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
program=10;
Open_programs_Callback(hObject, eventdata, handles, program)


% --- Executes on button press in randomdots.
function randomdots_Callback(hObject, eventdata, handles)
% hObject    handle to randomdots (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
program=11;
Open_programs_Callback(hObject, eventdata, handles, program)


% --- Executes on button press in pushbutton14.
function pushbutton14_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton14 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
program=12;
Open_programs_Callback(hObject, eventdata, handles, program)
