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

% Last Modified by GUIDE v2.5 16-Sep-2019 14:12:59

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

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

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = AxesBeispiel_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 button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
 %get the Columnnames 
 file= fullfile(pwd,'RaceMatrixfinal.mat');
load(file)
 Time=1;Pmani=2;Tintake=3;Tmani=4;LambdaL=5;LambdaR=6;AnaPedal=7;CamIn=8;CamIn2=9;CamOut=10;CamOut2=11;Gear=12;IgnAdv=13;Qinj=14;RPM=15;
 CarList = {47,48};
for CL=1:length(RaceMatrixfinal)
for z=1:length(RaceMatrixfinal{CL})


%create Array with different rgb codes for more colours to plot

colors =[ 0,255 ,0; 0,0,255;255,255,0;0,255,255;255,0,255;128,128,128;128,128,0;128,0,0;220,20,60;...
    255,69,0;154,205,50;124,252,0;144,238,144;0,250,154;25,25,112;75,0,130;0,0,0]; 



%Plot Cam  In in axes1
ylabel(handles.axes1,'CAM In [°] ');
xlabel(handles.axes1,'Drehzahl  [1/min]');
plot(handles.axes1,RaceMatrixfinal{CL}{z}(:,RPM),RaceMatrixfinal{CL}{z}(:,CamIn),'.','Color',1/255*colors(CL,:));

%Plot Cam  Out in axes2
ylabel(handles.axes2,'CAM Out [°] ');
xlabel(handles.axes2,'Drehzahl  [1/min]');
plot(handles.axes2,RaceMatrixfinal{CL}{z}(:,RPM),RaceMatrixfinal{CL}{z}(:,CamOut),'.','Color',1/255*colors(CL,:));




end
p(CL) =  plot(handles.axes2,NaN, NaN,'Color',1/255*colors(CL,:));
legend(p(CL),CarList(CL));
end

