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

% Last Modified by GUIDE v2.5 20-Jun-2014 23:45:36

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

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

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = Messdaten_Aufbereitung_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 import_lvm.
function import_lvm_Callback(hObject, eventdata, handles)
% hObject    handle to import_lvm (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%filename_lvm=get(handles.display_lvm, 'string');
filename_lvm=handles.filename_lvm;
if filename_lvm(end-2:end)=='mat'
   Import=load(filename_lvm);
    Messdaten=Import.Messung;
else
    Messdaten=importfile(filename_lvm,1,7);
end
handles.Messdaten=Messdaten;
assignin('base','Messdaten',Messdaten)
guidata(hObject,handles);




% --- Executes on button press in import_dat.
function import_dat_Callback(hObject, eventdata, handles)
% hObject    handle to import_dat (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
plot(handles.Messdaten);


% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)



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



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


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


% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (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 select_lvm.
function select_lvm_Callback(hObject, eventdata, handles)
% hObject    handle to select_lvm (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[name, path] = uigetfile('*.lvm;*.mat', 'Source file');
filename_lvm = [path name];
set(handles.display_lvm, 'string', filename_lvm)
handles.filename_lvm=filename_lvm;
guidata(hObject,handles)



% --- Executes on button press in select_dat.
function select_dat_Callback(hObject, eventdata, handles)
% hObject    handle to select_dat (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[name, path] = uigetfile('*dat', 'Source file');
filename_dat = [path name];
set(handles.display_dat, 'string', filename_dat)


% --- Executes on button press in togglebutton1.
function togglebutton1_Callback(hObject, eventdata, handles)
% hObject    handle to togglebutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of togglebutton1



function input_suchwert_Callback(hObject, eventdata, handles)
% hObject    handle to input_suchwert (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 input_suchwert as text
%        str2double(get(hObject,'String')) returns contents of input_suchwert as a double
handles.suchwert=str2double(get(hObject,'String'));
guidata(hObject,handles);


% --- Executes during object creation, after setting all properties.
function input_suchwert_CreateFcn(hObject, eventdata, handles)
% hObject    handle to input_suchwert (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
handles.suchwert=str2double(get(hObject,'String'));
guidata(hObject,handles);




function input_inkrement_Callback(hObject, eventdata, handles)
% hObject    handle to input_inkrement (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 input_inkrement as text
%        str2double(get(hObject,'String')) returns contents of input_inkrement as a double
handles.inkrement=str2double(get(hObject,'String'));
guidata(hObject,handles);


% --- Executes during object creation, after setting all properties.
function input_inkrement_CreateFcn(hObject, eventdata, handles)
% hObject    handle to input_inkrement (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
handles.inkrement=str2double(get(hObject,'String'));
guidata(hObject,handles);



function input_toleranz_Callback(hObject, eventdata, handles)
% hObject    handle to input_toleranz (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 input_toleranz as text
%        str2double(get(hObject,'String')) returns contents of input_toleranz as a double
handles.toleranz=str2double(get(hObject,'String'));
guidata(hObject,handles);


% --- Executes during object creation, after setting all properties.
function input_toleranz_CreateFcn(hObject, eventdata, handles)
% hObject    handle to input_toleranz (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
handles.toleranz=str2double(get(hObject,'String'));
guidata(hObject,handles);



function input_U_Callback(hObject, eventdata, handles)
% hObject    handle to input_U (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 input_U as text
%        str2double(get(hObject,'String')) returns contents of input_U as a double
handles.U=str2double(get(hObject,'String'));
guidata(hObject,handles);

% --- Executes during object creation, after setting all properties.
function input_U_CreateFcn(hObject, eventdata, handles)
% hObject    handle to input_U (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
handles.U=str2double(get(hObject,'String'));
guidata(hObject,handles);

% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on selection change in liste_labview.
function liste_labview_Callback(hObject, eventdata, handles)
% hObject    handle to liste_labview (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns liste_labview contents as cell array
%        contents{get(hObject,'Value')} returns selected item from liste_labview
%handles.list_sel_index = get(hObject, 'Value');
%guidata(hObject,handles);

% --- Executes during object creation, after setting all properties.
function liste_labview_CreateFcn(hObject, eventdata, handles)
% hObject    handle to liste_labview (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: listbox 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
%handles.liste_labview = hObject; 
%handles.list_sel_index = 1;
%guidata(hObject,handles);

% --- Executes on button press in messdaten_workspace.
function messdaten_workspace_Callback(hObject, eventdata, handles)
% hObject    handle to messdaten_workspace (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

list_sel_index=get(handles.liste_labview, 'Value');
switch list_sel_index
    case 1
        assignin('base','Temperaturen',handles.Temperaturen)
    case 2
        assignin('base','SSF',handles.SSF)
    case 3
        assignin('base','Verschiebungen_GM',handles.Verschiebungen_GM)
    case 4
        assignin('base','Verschiebungen_GM_i',handles.Verschiebungen_GM_i)
    case 5
        assignin('base','Taster3',handles.Taster3)
    case 6
        assignin('base','Taster4',handles.Taster4)
    case 7
        assignin('base','DeltaT_mid',handles.DeltaT_mid)
    case 8
        assignin('base','Fit2',handles.Fit2)
    case 9
        assignin('base','Bestimmtheitsmass',handles.Bestimmtheitsmass)
  end



% --- Executes on button press in pushbutton10.
function pushbutton10_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton10 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in messdaten_auswerten.
function messdaten_auswerten_Callback(hObject, eventdata, handles)
% hObject    handle to messdaten_auswerten (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(handles.liste_labview, 'String', {'plot(rand(5))', 'plot(sin(1:0.01:25))', 'bar(1:.5:10)', 'plot(membrane)', 'surf(peaks)'});
Labview_Daten;

% --- Executes when figure1 is resized.
function figure1_ResizeFcn(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)



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