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

% Last Modified by GUIDE v2.5 10-Jun-2014 18:19:09

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

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

%handles.figure1 = gcf;

% Update handles structure
guidata(hObject, handles);

handles.menu1 =uimenu (  'Parent', handles.figure1,...
                        'Label','Modelle',...
                        'HandleVisibility','off');
handles.menu11=uimenu (  'Parent',handles.menu1,...
                        'Label','Modell neu laden',...
                        'Callback',{@ModellInput,handles});
                   
                    
handles.menu2 =uimenu (  'Parent', handles.figure1,...
                        'Label','Pulsprotokoll',...
                        'HandleVisibility','off');
handles.menu21=uimenu (  'Parent',handles.menu2,...
                        'Label','Pulsprotokoll neu laden',...
                        'Callback',{@PulsInput,handles});

handles.menu3 =uimenu (  'Parent', handles.figure1,...
                        'Label','Speichern',...
                        'HandleVisibility','off');
handles.menu31=uimenu (  'Parent',handles.menu3,...
                        'Label','alles Speichern in Excel',...
                        'Callback',{@alles_speichern,handles});
handles.menu32=uimenu (  'Parent',handles.menu3,...
                        'Label','MW Strom csv',...
                        'Callback',{@MW_Strom,handles});
handles.menu33=uimenu (  'Parent',handles.menu3,...
                        'Label','MW Fluoreszenz csv',...
                        'Callback',{@MW_Fluor,handles});
handles.menu34=uimenu (  'Parent',handles.menu3,...
                        'Label','Standabw Strom csv',...
                        'Callback',{@Stabw_Strom,handles});
                    
handles.menu35=uimenu (  'Parent',handles.menu3,...
                        'Label','Standabw Fluoreszenz csv',...
                        'Callback',{@Stabw_Fluor,handles});
guidata(hObject, handles);   % handles.fh1 wird in handles struktur aufgenommen
                
% UIWAIT makes Simulation_V3 wait for user response (see UIRESUME)
uiwait(handles.figure1);
%uiwait(handles.fh1);


% --- Outputs from this function are returned to the command line.
function varargout = Simulation_V3_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;
delete(hObject); 


 %---------------------------------------------------------------------
function ModellInput(hObject, eventdata, handles)

    [FileNameM,PathNameM]=uigetfile('*.m');
    if FileNameM~=0      % Nur wenn ein file ausgewählt wurde
        FilePathM=fullfile(PathNameM,FileNameM);
        set(handles.Modellname,'String',FileNameM);
        handles.Modell=FileNameM(1:end-2);

    end
    
    % Die handles-struktur aktualisieren
guidata(hObject, handles);
 %---------------------------------------------------------------------    
  function PulsInput(hObject, eventdata, handles)
        
  [FileNameP,PathNameP]=uigetfile('*.m');
    if FileNameP~=0      % Nur wenn ein file ausgewählt wurde
        FilePathP=fullfile(PathNameP,FileNameP);
        set(handles.Pulsname,'String',FileNameP);
        handles.Puls=FileNameP(1:end-2);
     
    end       
    
    % Die handles-struktur aktualisieren
guidata(hObject, handles);      


% --- Executes when user attempts to close figure1.
function figure1_CloseRequestFcn(hObject, eventdata, handles)
% hObject    handle to figure1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: delete(hObject) closes the figure
uiresume(handles.figure1);
