gusucode.com > NEWTOOLBOX_demo > NEWTOOLBOX_demo/test.m

    function varargout = test(varargin)

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

% Last Modified by GUIDE v2.5 25-Feb-2019 13:59:36

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

% Choose default command line output for test
handles.output = hObject;
axes(handles.axes1);
im=imread('logo.jpg');
imshow(im);
% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = test_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;



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


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


% --- Executes during object creation, after setting all properties.
function BLOCK_CreateFcn(hObject, eventdata, handles)
% hObject    handle to BLOCK (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 when selected object is changed in ELM_PNL.
function ELM_PNL_SelectionChangeFcn(hObject, eventdata, handles)
% hObject    handle to the selected object in ELM_PNL 
% 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)
choise=get(handles.ELM_PNL,'SelectedObject');
selection=get(choise,'string');
switch selection
    case 'ELM'
     set(handles.NEURONS,'Enable','on')
     set(handles.BLOCK,'Enable','off')
     set(handles.INITIAL,'Enable','off')
     set(handles.NA,'Enable','off')
     set(handles.INN,'Enable','off')
     set(handles.AHN,'Enable','off')
     set(handles.Tol,'Enable','off')
     set(handles.NUN,'Enable','off')
    case 'OSELM'
    set(handles.NEURONS,'Enable','on')
    set(handles.BLOCK,'Enable','on') 
    set(handles.INITIAL,'Enable','on')
    set(handles.NA,'Enable','off')
    set(handles.INN,'Enable','off')
    set(handles.AHN,'Enable','off')
    set(handles.Tol,'Enable','off')
    set(handles.NUN,'Enable','off')
    case 'ELM_DBN'
    set(handles.NEURONS,'Enable','off')
    set(handles.BLOCK,'Enable','off')
    set(handles.INITIAL,'Enable','off')
    set(handles.NA,'Enable','on')
    set(handles.INN,'Enable','off')
    set(handles.AHN,'Enable','off')
    set(handles.Tol,'Enable','off')
    set(handles.NUN,'Enable','off')
    case 'SC_I_ELM'
    set(handles.NEURONS,'Enable','on')
    set(handles.BLOCK,'Enable','off')
    set(handles.INITIAL,'Enable','off')
    set(handles.NA,'Enable','off')
    set(handles.INN,'Enable','on')
    set(handles.AHN,'Enable','on')
    set(handles.Tol,'Enable','on')
    set(handles.NUN,'Enable','on')
end


% --- Executes on button press in start.
function start_Callback(hObject, eventdata, handles)
clc;
% hObject    handle to start (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
choise=get(handles.ELM_PNL,'SelectedObject');
selection=get(choise,'string');
choise2=get(handles.typepnl,'SelectedObject');
Type=get(choise2,'string');

x=dlmread(get(handles.TI,'string'));
y=dlmread(get(handles.TT,'string'));
xts=dlmread(get(handles.TsI,'string'));
yts=dlmread(get(handles.TsT,'string'));


switch Type
    
    case 'regression'
    ELM_TYPE=0;
    case 'classification'
    ELM_TYPE=1;      
end
switch selection
    case 'ELM'
    N=str2double(get(handles.NEURONS,'string'));
    [Training_Accuracy,Testing_Accuracy]=elm_train(x,y,xts,yts,N,ELM_TYPE);%basic ELM
    case 'OSELM'
    N=str2double(get(handles.NEURONS,'string'));
    Block=str2double(get(handles.BLOCK,'string'));
    Initialdata=str2double(get(handles.INITIAL,'string'));
    [Training_Accuracy,Testing_Accuracy]=OS_elm_train(x,y,xts,yts,N,Initialdata,Block,ELM_TYPE);%online sequential ELM
    case 'ELM_DBN'
     Network_architecture=str2num(get(handles.NA,'string'));
    [Training_Accuracy,Testing_Accuracy]=DBN_ELM(x,y,xts,yts,Network_architecture,ELM_TYPE); % deep belif nets   
    case 'SC_I_ELM'
    N=str2double(get(handles.NEURONS,'string'));
    Initial_number_neurons=str2double(get(handles.INN,'string'));
    Additive_hidden_nodes=str2double(get(handles.AHN,'string'));
    Tol=str2double(get(handles.Tol,'string'));
    [E,usedNeurons,Training_Accuracy,Testing_Accuracy]=I_elm_train(x,y,xts,yts,Initial_number_neurons,N,Additive_hidden_nodes,Tol);
    set(handles.NUN,'string',usedNeurons);
end
set(handles.T,'string',Training_Accuracy);
set(handles.Ts,'string',Testing_Accuracy);
% Update handles structure
guidata(hObject, handles);




% --- Executes when selected object is changed in typepnl.
function typepnl_SelectionChangeFcn(hObject, eventdata, handles)
% hObject    handle to the selected object in typepnl 
% 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)
choise2=get(handles.typepnl,'SelectedObject');
Type=get(choise2,'string');



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


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


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


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


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


% --- Executes during object creation, after setting all properties.
function yts_CreateFcn(hObject, eventdata, handles)
% hObject    handle to yts (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 LTI.
function LTI_Callback(hObject, eventdata, handles)
% hObject    handle to LTI (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[filename pathname]=uigetfile({'*.txt'},'File Selector');
fullpathname=strcat(pathname,filename);
set(handles.TI,'string',fullpathname);
% --- Executes on button press in LTT.
function LTT_Callback(hObject, eventdata, handles)
% hObject    handle to LTT (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[filename pathname]=uigetfile({'*.txt'},'File Selector');
fullpathname=strcat(pathname,filename);
set(handles.TT,'string',fullpathname);

% --- Executes on button press in LTsI.
function LTsI_Callback(hObject, eventdata, handles)
% hObject    handle to LTsI (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[filename pathname]=uigetfile({'*.txt'},'File Selector');
fullpathname=strcat(pathname,filename);
set(handles.TsI,'string',fullpathname);

% --- Executes on button press in LTsT.
function LTsT_Callback(hObject, eventdata, handles)
% hObject    handle to LTsT (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[filename pathname]=uigetfile({'*.txt'},'File Selector');
fullpathname=strcat(pathname,filename);
set(handles.TsT,'string',fullpathname);



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


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


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


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


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