No BSD License  

Highlights from
GUI for the performance analysis of pedelecs

image thumbnail
from GUI for the performance analysis of pedelecs by Jan Cappelle
Modeling the behaviour of electric bicycles

Comparison(varargin)
function varargout = Comparison(varargin)
%COMPARISON M-file for Comparison.fig
%      COMPARISON, by itself, creates a new COMPARISON or raises the existing
%      singleton*.
%
%      H = COMPARISON returns the handle to a new COMPARISON or the handle to
%      the existing singleton*.
%
%      COMPARISON('Property','Value',...) creates a new COMPARISON using the
%      given property value pairs. Unrecognized properties are passed via
%      varargin to Comparison_OpeningFcn.  This calling syntax produces a
%      warning when there is an existing singleton*.
%
%      COMPARISON('CALLBACK') and COMPARISON('CALLBACK',hObject,...) call the
%      local function named CALLBACK in COMPARISON.M with the given input
%      arguments.
%
%      *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 Comparison

% Last Modified by GUIDE v2.5 11-May-2007 11:51:17

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @Comparison_OpeningFcn, ...
                   'gui_OutputFcn',  @Comparison_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 Comparison is made visible.
function Comparison_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   unrecognized PropertyName/PropertyValue pairs from the
%            command line (see VARARGIN)

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


addpath(genpath(fullfile(matlabroot,'toolbox\LSSVM')));
addpath(genpath(fullfile(matlabroot,'toolbox\Pedelecs')));
addpath(genpath(fullfile(matlabroot,'toolbox\Pedelecs\drivecycles')));
addpath(genpath(fullfile(matlabroot,'toolbox\Pedelecs\drivecycles\@cycles')));

handles.pedelec1put=0;
handles.pedelec2put=0;



% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = Comparison_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 eta_Callback(hObject, eventdata, handles)
% hObject    handle to eta (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 eta as text
%        str2double(get(hObject,'String')) returns contents of eta as a double


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


% --- Executes during object creation, after setting all properties.
function eta2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to eta2 (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 etaplot.
function etaplot_Callback(hObject, eventdata, handles)
% hObject    handle to etaplot (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if handles.pedelec1put*handles.pedelec2put==0
    errordlg('Please enter the full pathname of the data files with the performance parameters for both pedelecs','Bad Input','modal')
else
    probfile1=handles.Browse1;%look for the 'folder/pedelec.mat'
    probfile2=handles.Browse2;
    if exist(probfile1)==0
        errordlg('The file for pedelec1 you entered does not exist','Bad Input','modal')
    elseif exist(probfile2)==0
        errordlg('The file for pedelec2 you entered does not exist','Bad Input','modal')
        %isfield(probfile1,'UI')
    else
       p1=load(probfile1);
       p2=load(probfile2);
        etat1=lookfora('ETA',p1.UI);
        etat2=lookfora('ETA',p2.UI);
        rs=ranksum(etat1,etat2);
        figure(1)
        group = [repmat({'Pedelec 1'},length(etat1), 1); repmat({'Pedelec 2'}, length(etat2), 1)];
        boxplot([etat1;etat2],group)
        ylabel('\eta [%]','rotation',0)
        str={'boxplots of the 100W efficiencies'};
        title(str,'fontsize',12)
        axis([0.5 2.5 0 100])
        text(1.3,30,'Wilcoxon test result','VerticalAlignment','middle')
        text(1.5,26,num2str(rs,4))    
    end
end
guidata(hObject,handles);


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


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


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


% --- Executes during object creation, after setting all properties.
function ksiMAp_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ksiMAp (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 ksiplot.
function ksiplot_Callback(hObject, eventdata, handles)
% hObject    handle to ksiplot (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if handles.pedelec1put*handles.pedelec2put==0
    errordlg('Please enter the full pathname of the data files with the performance parameters for both pedelecs','Bad Input','modal')
else
    probfile1=handles.Browse1;%look for the 'folder/pedelec.mat'
    probfile2=handles.Browse2;
    if exist(probfile1)==0
        errordlg('The file for pedelec1 you entered does not exist','Bad Input','modal')
    elseif exist(probfile2)==0
        errordlg('The file for pedelec2 you entered does not exist','Bad Input','modal')
        %isfield(probfile1,'UI')
    else
       p1=load(probfile1);
       p2=load(probfile2);
        xi1=lookfor2a('XI',p1.UI,'MAe');
        xi2=lookfor2a('XI',p2.UI,'MAe');
        if isempty(xi1)+isempty(xi2)==0
        rs=ranksum(xi1,xi2);
        figure(1)
        group = [repmat({'Pedelec 1'},length(xi1), 1); repmat({'Pedelec 2'}, length(xi2), 1)];
        boxplot([xi1;xi2],group)
        ylabel('\xi','rotation',0)
        str={'boxplots of the 75W MAe assistance factors'};
        title(str,'fontsize',12)
        axis([0.5 2.5 0 1])
        text(1.3,0.80,'Wilcoxon test result','VerticalAlignment','middle')
        text(1.5,0.76,num2str(rs,4))
        %else
        %    errordlg('The MAe mode of one of the pedelecs is not available','Bad Input','modal')
        end
        
        
        xi1=lookfor2a('XI',p1.UI,'MAn');
        xi2=lookfor2a('XI',p2.UI,'MAn');
        if isempty(xi1)+isempty(xi2)==0
        rs=ranksum(xi1,xi2);
        figure(2)
        group = [repmat({'Pedelec 1'},length(xi1), 1); repmat({'Pedelec 2'}, length(xi2), 1)];
        boxplot([xi1;xi2],group)
        ylabel('\xi','rotation',0)
        str={'boxplots of the 75W MAn assistance factors'};
        title(str,'fontsize',12)
        axis([0.5 2.5 0 1])
        text(1.3,0.80,'Wilcoxon test result','VerticalAlignment','middle')
        text(1.5,0.76,num2str(rs,4)) 
        end
    
        xi1=lookfor2a('XI',p1.UI,'MAp');
        xi2=lookfor2a('XI',p2.UI,'MAp');
        if isempty(xi1)+isempty(xi2)==0
        rs=ranksum(xi1,xi2);
        figure(3)
        group = [repmat({'Pedelec 1'},length(xi1), 1); repmat({'Pedelec 2'}, length(xi2), 1)];
        boxplot([xi1;xi2],group)
        ylabel('\xi','rotation',0)
        str={'boxplots of the 75W MAp assistance factors'};
        title(str,'fontsize',12)
        axis([0.5 2.5 0 1])
        text(1.3,0.80,'Wilcoxon test result','VerticalAlignment','middle')
        text(1.5,0.76,num2str(rs,4))   
        end
    end
end
guidata(hObject,handles);


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


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


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


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


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


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


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


% --- Executes during object creation, after setting all properties.
function SAMAp_CreateFcn(hObject, eventdata, handles)
% hObject    handle to SAMAp (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 SAplot.
function SAplot_Callback(hObject, eventdata, handles)
% hObject    handle to SAplot (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if handles.pedelec1put*handles.pedelec2put==0
    errordlg('Please enter the full pathname of the data files with the performance parameters for both pedelecs','Bad Input','modal')
else
    probfile1=handles.Browse1;%look for the 'folder/pedelec.mat'
    probfile2=handles.Browse2;
    if exist(probfile1)==0
        errordlg('The file for pedelec1 you entered does not exist','Bad Input','modal')
    elseif exist(probfile2)==0
        errordlg('The file for pedelec2 you entered does not exist','Bad Input','modal')
        %isfield(probfile1,'UI')
    else
       p1=load(probfile1);
       p2=load(probfile2);
        sa1=lookfor2a('SA',p1.UI,'ZA');
        sa2=lookfor2a('SA',p2.UI,'ZA');
        if isempty(sa1)+isempty(sa2)==0
        rs=ranksum(sa1,sa2);
        figure(1)
        group = [repmat({'Pedelec 1'},length(sa1), 1); repmat({'Pedelec 2'}, length(sa2), 1)];
        boxplot([sa1;sa2],group)
        ylabel('Slope-ability [%]')
        str={'boxplots of the 100W Slope-ability without assistance'};
        title(str,'fontsize',12)
        axis([0.5 2.5 0 30])
        text(1.3,24,'Wilcoxon test result','VerticalAlignment','middle')
        text(1.5,22,num2str(rs,4))   
        end
        
         p1=load(probfile1);
       p2=load(probfile2);
        sa1=lookfor2a('SA',p1.UI,'MAe');
        sa2=lookfor2a('SA',p2.UI,'MAe');
         if isempty(sa1)+isempty(sa2)==0
        rs=ranksum(sa1,sa2);
        figure(2)
        group = [repmat({'Pedelec 1'},length(sa1), 1); repmat({'Pedelec 2'}, length(sa2), 1)];
        boxplot([sa1;sa2],group)
        ylabel('Slope-ability [%]')
        str={'boxplots of the 100W Slope-ability with MAe assistance'};
        title(str,'fontsize',12)
        axis([0.5 2.5 0 30])
        text(1.3,24,'Wilcoxon test result','VerticalAlignment','middle')
        text(1.5,22,num2str(rs,4))    
         end
         
          p1=load(probfile1);
       p2=load(probfile2);
        sa1=lookfor2a('SA',p1.UI,'MAn');
        sa2=lookfor2a('SA',p2.UI,'MAn');
         if isempty(sa1)+isempty(sa2)==0
        rs=ranksum(sa1,sa2);
        figure(3)
        group = [repmat({'Pedelec 1'},length(sa1), 1); repmat({'Pedelec 2'}, length(sa2), 1)];
        boxplot([sa1;sa2],group)
        ylabel('Slope-ability [%]')
        str={'boxplots of the 100W Slope-ability with MAn assistance'};
        title(str,'fontsize',12)
        axis([0.5 2.5 0 30])
        text(1.3,24,'Wilcoxon test result','VerticalAlignment','middle')
        text(1.5,22,num2str(rs,4))    
         end
         
          p1=load(probfile1);
       p2=load(probfile2);
        sa1=lookfor2a('SA',p1.UI,'MAp');
        sa2=lookfor2a('SA',p2.UI,'MAp');
         if isempty(sa1)+isempty(sa2)==0
        rs=ranksum(sa1,sa2);
        figure(3)
        group = [repmat({'Pedelec 1'},length(sa1), 1); repmat({'Pedelec 2'}, length(sa2), 1)];
        boxplot([sa1;sa2],group)
        ylabel('Slope-ability [%]')
        str={'boxplots of the 100W Slope-ability with MAp assistance'};
        title(str,'fontsize',12)
        axis([0.5 2.5 0 30])
        text(1.3,24,'Wilcoxon test result','VerticalAlignment','middle')
        text(1.5,22,num2str(rs,4))
         end
    end
end
guidata(hObject,handles);


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


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


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


% --- Executes during object creation, after setting all properties.
function DCeta_CreateFcn(hObject, eventdata, handles)
% hObject    handle to DCeta (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 DCetaplot.
function DCetaplot_Callback(hObject, eventdata, handles)
% hObject    handle to DCetaplot (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if handles.pedelec1put*handles.pedelec2put==0
    errordlg('Please enter the full pathname of the data files with the performance parameters for both pedelecs','Bad Input','modal')
else
    probfile1=handles.Browse1;%look for the 'folder/pedelec.mat'
    probfile2=handles.Browse2;
    if exist(probfile1)==0
        errordlg('The file for pedelec1 you entered does not exist','Bad Input','modal')
    elseif exist(probfile2)==0
        errordlg('The file for pedelec2 you entered does not exist','Bad Input','modal')
        %isfield(probfile1,'UI')
    else
       p1=load(probfile1);
       p2=load(probfile2);
        etat11=lookfora('ETA',p1.UD);
        etat22=lookfora('ETA',p2.UD);
        %the NaN have to be removed, to calculate the ranksum
        i=1;
        for k=1:length(etat11)
            if isnan(etat11(k))
                i=i+1;
            else
                etat1(k)=etat11(k);
                i=i+1;
            end
        end
                
        i=1;
        for k=1:length(etat22)
            if isnan(etat22(k))
                i=i+1;
            else
                etat2(k)=etat22(k);
                i=i+1;
            end
        end
        
        rs=ranksum(etat1,etat2);
        figure(1)
        group = [repmat({'Pedelec 1'},length(etat1), 1); repmat({'Pedelec 2'}, length(etat2), 1)];
        boxplot([etat1';etat2'],group)
        ylabel('\eta [%]','rotation',0)
        str={'boxplots of the drive cycle efficiencies'};
        title(str,'fontsize',12)
        axis([0.5 2.5 0 100])
        text(1.3,30,'Wilcoxon test result')
        text(1.5,26,num2str(rs,4))    
    end
end
guidata(hObject,handles);



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


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


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


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


% --- Executes during object creation, after setting all properties.
function DCksiMAp_CreateFcn(hObject, eventdata, handles)
% hObject    handle to DCksiMAp (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 DCksiplot.
function DCksiplot_Callback(hObject, eventdata, handles)
% hObject    handle to DCksiplot (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if handles.pedelec1put*handles.pedelec2put==0
    errordlg('Please enter the full pathname of the data files with the performance parameters for both pedelecs','Bad Input','modal')
else
    probfile1=handles.Browse1;%look for the 'folder/pedelec.mat'
    probfile2=handles.Browse2;
    if exist(probfile1)==0
        errordlg('The file for pedelec1 you entered does not exist','Bad Input','modal')
    elseif exist(probfile2)==0
        errordlg('The file for pedelec2 you entered does not exist','Bad Input','modal')
        %isfield(probfile1,'UI')
    else
       p1=load(probfile1);
       p2=load(probfile2);
        xi1=lookfor2a('XI',p1.UD,'MAe');
        xi2=lookfor2a('XI',p2.UD,'MAe');
         if isempty(xi1)+isempty(xi2)==0
        rs=ranksum(xi1,xi2);
        figure(1)
        group = [repmat({'Pedelec 1'},length(xi1), 1); repmat({'Pedelec 2'}, length(xi2), 1)];
        boxplot([xi1;xi2],group)
        ylabel('\xi','rotation',0)
        str={'boxplots of the Drive Cycle MAe assistance factors'};
        title(str,'fontsize',12)
        axis([0.5 2.5 0 1])
        text(1.3,0.80,'Wilcoxon test result','VerticalAlignment','middle')
        text(1.5,0.76,num2str(rs,4))
         end
        
        xi1=lookfor2a('XI',p1.UD,'MAn');
        xi2=lookfor2a('XI',p2.UD,'MAn');
         if isempty(xi1)+isempty(xi2)==0
        rs=ranksum(xi1,xi2);
        figure(2)
        group = [repmat({'Pedelec 1'},length(xi1), 1); repmat({'Pedelec 2'}, length(xi2), 1)];
        boxplot([xi1;xi2],group)
        ylabel('\xi','rotation',0)
        str={'boxplots of the Drive Cycle MAn assistance factors'};
        title(str,'fontsize',12)
        axis([0.5 2.5 0 1])
        text(1.3,0.80,'Wilcoxon test result','VerticalAlignment','middle')
        text(1.5,0.76,num2str(rs,4))    
         end
         
         
        xi1=lookfor2a('XI',p1.UD,'MAp');
        xi2=lookfor2a('XI',p2.UD,'MAp');
         if isempty(xi1)+isempty(xi2)==0
        rs=ranksum(xi1,xi2);
        figure(3)
        group = [repmat({'Pedelec 1'},length(xi1), 1); repmat({'Pedelec 2'}, length(xi2), 1)];
        boxplot([xi1;xi2],group)
        ylabel('\xi','rotation',0)
        str={'boxplots of the Drive Cycle MAp assistance factors'};
        title(str,'fontsize',12)
        axis([0.5 2.5 0 1])
        text(1.3,0.80,'Wilcoxon test result','VerticalAlignment','middle')
        text(1.5,0.76,num2str(rs,4))    
         end
    end
end
guidata(hObject,handles);


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


% --- Executes during object creation, after setting all properties.
function DCMAp2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to DCMAp2 (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 pedelec2_Callback(hObject, eventdata, handles)
% hObject    handle to pedelec2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
a=get(hObject,'string');
set(handles.pedelec2,'string',a);
handles.pedelec2put=1;
guidata(hObject,handles);

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


% --- Executes during object creation, after setting all properties.
function pedelec2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to pedelec2 (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 pedelec1_Callback(hObject, eventdata, handles)
% hObject    handle to pedelec1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
a=get(hObject,'string');
set(handles.pedelec1,'string',a);
handles.pedelec1put=1;
guidata(hObject,handles);

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


% --- Executes during object creation, after setting all properties.
function pedelec1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to pedelec1 (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 Browse2.
function Browse2_Callback(hObject, eventdata, handles)
% hObject    handle to Browse2 (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('*.mat','Select the Mat-file for the 2nd pedelec');
handles.pedelec2put=1;
handles.Browse2=fullfile(PathName,FileName);
set(handles.pedelec2,'string',handles.Browse2);
guidata(hObject,handles);


% --- Executes on button press in Browse1.
function Browse1_Callback(hObject, eventdata, handles)
% hObject    handle to Browse1 (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('*.mat','Select the Mat-file for the 2nd pedelec');
handles.Browse1=fullfile(PathName,FileName);
handles.pedelec1put=1;
set(handles.pedelec1,'string',handles.Browse1);
guidata(hObject,handles);

% --- Executes on button press in Fill.
function Fill_Callback(hObject, eventdata, handles)
% hObject    handle to Fill (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(handles.eta,'string','?');
set(handles.ksiMAe,'string','?');
set(handles.ksiMAn,'string','?');
set(handles.ksiMAp,'string','?');
set(handles.SAZA,'string','?');
set(handles.SAMAe,'string','?');
set(handles.SAMAn,'string','?');
set(handles.SAMAp,'string','?');

set(handles.DCeta,'string','?');
set(handles.DCksiMAe,'string','?');
set(handles.DCksiMAn,'string','?');
set(handles.DCksiMAp,'string','?');
set(handles.WcZA,'string','?');
set(handles.WcMAe,'string','?');
set(handles.WcMAn,'string','?');
set(handles.WcMAp,'string','?');
set(handles.DcMAe,'string','?');
set(handles.DcMAn,'string','?');
set(handles.DcMAp,'string','?');

set(handles.eta2,'string','?');
set(handles.ksiMAe2,'string','?');
set(handles.ksiMAn2,'string','?');
set(handles.ksiMAp2,'string','?');
set(handles.SAZA2,'string','?');
set(handles.SAMAe2,'string','?');
set(handles.SAMAn2,'string','?');
set(handles.SAMAp2,'string','?');

set(handles.DCeta2,'string','?');
set(handles.DCksiMAe2,'string','?');
set(handles.DCksiMAn2,'string','?');
set(handles.DCksiMAp2,'string','?');
set(handles.WcZA2,'string','?');
set(handles.WcMAe2,'string','?');
set(handles.WcMAn2,'string','?');
set(handles.WcMAp2,'string','?');
set(handles.DCMAe2,'string','?');
set(handles.DCMAn2,'string','?');
set(handles.DCMAp2,'string','?');
if handles.pedelec1put*handles.pedelec2put==0
    errordlg('Please enter the full pathname of the data files with the performance parameters for both pedelecs','Bad Input','modal')
else
    probfile1=handles.Browse1;%look for the 'folder/pedelec.mat'
    probfile2=handles.Browse2;
    if exist(probfile1)==0
        errordlg('The file for pedelec1 you entered does not exist','Bad Input','modal')
    elseif exist(probfile2)==0
        errordlg('The file for pedelec2 you entered does not exist','Bad Input','modal')
        %isfield(probfile1,'UI')
    else
       p1=load(probfile1);
       %Fill in all UI fields for pedelec 1 
       lookfor1('ETA',p1.UI,handles.eta);
       lookfor2('XI',p1.UI,handles.ksiMAe,'MAe');
       lookfor2('XI',p1.UI,handles.ksiMAn,'MAn');
       lookfor2('XI',p1.UI,handles.ksiMAp,'MAp');
       lookfor2('SA',p1.UI,handles.SAZA,'ZA');
       lookfor2('SA',p1.UI,handles.SAMAe,'MAe');
       lookfor2('SA',p1.UI,handles.SAMAn,'MAn');
       lookfor2('SA',p1.UI,handles.SAMAp,'MAp');
       
       
       %Fill in all UI fields for pedelec 2 
       p2=load(probfile2);
       lookfor1('ETA',p2.UI,handles.eta2);
       lookfor2('XI',p2.UI,handles.ksiMAe2,'MAe');
       lookfor2('XI',p2.UI,handles.ksiMAn2,'MAn');
       lookfor2('XI',p2.UI,handles.ksiMAp2,'MAp');
       lookfor2('SA',p2.UI,handles.SAZA2,'ZA');
       lookfor2('SA',p2.UI,handles.SAMAe2,'MAe');
       lookfor2('SA',p2.UI,handles.SAMAn2,'MAn');
       lookfor2('SA',p2.UI,handles.SAMAp2,'MAp');
       
       %Fill in all UD fields for pedelec 1 
       lookfor1('ETA',p1.UD,handles.DCeta);
       lookfor2('XI',p1.UD,handles.DCksiMAe,'MAe');
       lookfor2('XI',p1.UD,handles.DCksiMAn,'MAn');
       lookfor2('XI',p1.UD,handles.DCksiMAp,'MAp');
       lookfor3('BR',p1.UD,handles.DcMAe,'MAe');
       lookfor3('BR',p1.UD,handles.DcMAn,'MAn');
       lookfor3('BR',p1.UD,handles.DcMAp,'MAp');
       lookfor3('HEI',p1.UD,handles.WcZA,'ZA');
       lookfor3('HEI',p1.UD,handles.WcMAe,'MAe');
       lookfor3('HEI',p1.UD,handles.WcMAn,'MAn');
       lookfor3('HEI',p1.UD,handles.WcMAp,'MAp');
       
       %Fill in all UD fields for pedelec 2 
       lookfor1('ETA',p2.UD,handles.DCeta2);
       lookfor2('XI',p2.UD,handles.DCksiMAe2,'MAe');
       lookfor2('XI',p2.UD,handles.DCksiMAn2,'MAn');
       lookfor2('XI',p2.UD,handles.DCksiMAp2,'MAp');
       lookfor3('BR',p2.UD,handles.DCMAe2,'MAe');
       lookfor3('BR',p2.UD,handles.DCMAn2,'MAn');
       lookfor3('BR',p2.UD,handles.DCMAp2,'MAp');
       lookfor3('HEI',p2.UD,handles.WcZA2,'ZA');
       lookfor3('HEI',p2.UD,handles.WcMAe2,'MAe');
       lookfor3('HEI',p2.UD,handles.WcMAn2,'MAn');
       lookfor3('HEI',p2.UD,handles.WcMAp2,'MAp');
       end
end



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


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


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


Contact us