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

% Last Modified by GUIDE v2.5 23-Aug-2012 21:45:13

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

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

handles.x=hObject;
handles.y=hObject;
handles.xF=hObject;
handles.yF=hObject;
handles.muu=hObject;
handles.muo=hObject;
handles.alpha=hObject;
handles.G=hObject;
handles.textF_min=hObject;

% Update handles structure
guidata(hObject, handles);


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


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

% --- Executes during object creation, after setting all properties.
function editx_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editx (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 edity_Callback(hObject, eventdata, handles)
% hObject    handle to edity (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 edity as text
%        str2double(get(hObject,'String')) returns contents of edity as a double
y=str2num(get(handles.edity, 'String'));
y=str2double(y);
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function edity_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edity (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 editxF_Callback(hObject, eventdata, handles)
% hObject    handle to editxF (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 editxF as text
%        str2double(get(hObject,'String')) returns contents of editxF as a double
xF=(get(handles.editxF, 'String'));
xF=str2double(xF)
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function editxF_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editxF (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 edityF_Callback(hObject, eventdata, handles)
% hObject    handle to edityF (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 edityF as text
%        str2double(get(hObject,'String')) returns contents of edityF as a double
yF=(get(handles.edityF, 'String'));
yF=str2double(yF)
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function edityF_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edityF (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 editmuu_Callback(hObject, eventdata, handles)
% hObject    handle to editmuu (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 editmuu as text
%        str2double(get(hObject,'String')) returns contents of editmuu as a double
muu=(get(handles.editmuu, 'String'));
muu=str2double(muu)
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function editmuu_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editmuu (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 editmuo_Callback(hObject, eventdata, handles)
% hObject    handle to editmuo (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 editmuo as text
%        str2double(get(hObject,'String')) returns contents of editmuo as a double
muo=(get(handles.editmuo, 'String'));
muo=str2double(muo);
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function editmuo_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editmuo (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 editalpha_Callback(hObject, eventdata, handles)
% hObject    handle to editalpha (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 editalpha as text
%        str2double(get(hObject,'String')) returns contents of editalpha as a double
Winkel=(get(handles.editalpha, 'String'));
Winkel=str2double(Winkel);
alpha=Winkel*pi/180;
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function editalpha_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editalpha (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 editG_Callback(hObject, eventdata, handles)
% hObject    handle to editG (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 editG as text
%        str2double(get(hObject,'String')) returns contents of editG as a double
G=(get(handles.editG, 'String'));
G=str2double(G)
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function editG_CreateFcn(hObject, eventdata, handles)
% hObject    handle to editG (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 pushbuttonmasse.
function pushbuttonmasse_Callback(hObject, eventdata, handles)
% hObject    handle to pushbuttonmasse (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
Bild0=hgload('Tuerdaten.fig')
%set(Bild0,'Position',[5,5,500,600])
 



% --- Executes on button press in pushbuttonBerechne.
function pushbuttonBerechne_Callback(hObject, eventdata, handles)
% hObject    handle to pushbuttonBerechne (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
F_Ruhe=G*muu/(cos(alpha)+muu*sin(alpha))
xFN=muu*cos(alpha)*yF/(cos(alpha)+muu*sin(alpha))+x/2;
if xFN > x
    Meldung1(['Die Tür kippt, bevor sie sich bewegt!','xFN = ',num2str(xFN),' mm > x = ',num2str(x),' mm!'])
    msgbox(Meldung1,'ACHTUNG','error')
end 
guidata(hObject, handles);
set(handles.textF_min,'String',F_Ruhe)



% --- Executes on key press with focus on pushbuttonBerechne and none of its controls.
function pushbuttonBerechne_KeyPressFcn(hObject, eventdata, handles)
% hObject    handle to pushbuttonBerechne (see GCBO)
% eventdata  structure with the following fields (see UICONTROL)
%	Key: name of the key that was pressed, in lower case
%	Character: character interpretation of the key(s) that was pressed
%	Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles    structure with handles and user data (see GUIDATA)
