Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function varargout = alkomat2(varargin)
- % ALKOMAT2 MATLAB code for alkomat2.fig
- % ALKOMAT2, by itself, creates a new ALKOMAT2 or raises the existing
- % singleton*.
- %
- % H = ALKOMAT2 returns the handle to a new ALKOMAT2 or the handle to
- % the existing singleton*.
- %
- % ALKOMAT2('CALLBACK',hObject,eventData,handles,...) calls the local
- % function named CALLBACK in ALKOMAT2.M with the given input arguments.
- %
- % ALKOMAT2('Property','Value',...) creates a new ALKOMAT2 or raises the
- % existing singleton*. Starting from the left, property value pairs are
- % applied to the GUI before alkomat2_OpeningFcn gets called. An
- % unrecognized property name or invalid value makes property application
- % stop. All inputs are passed to alkomat2_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 alkomat2
- % Last Modified by GUIDE v2.5 17-Jan-2017 12:57:43
- % Begin initialization code - DO NOT EDIT
- gui_Singleton = 1;
- gui_State = struct('gui_Name', mfilename, ...
- 'gui_Singleton', gui_Singleton, ...
- 'gui_OpeningFcn', @alkomat2_OpeningFcn, ...
- 'gui_OutputFcn', @alkomat2_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
- end
- % --- Executes just before alkomat2 is made visible.
- function alkomat2_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 alkomat2 (see VARARGIN)
- % Choose default command line output for alkomat2
- handles.output = hObject;
- % Update handles structure
- guidata(hObject, handles);
- end
- % UIWAIT makes alkomat2 wait for user response (see UIRESUME)
- % uiwait(handles.figure1);
- % --- Outputs from this function are returned to the command line.
- function varargout = alkomat2_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;
- end
- % --- Executes on selection change in wybor_plci.
- function wybor_plci_Callback(hObject, eventdata, handles)
- % hObject handle to wybor_plci (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- sex = get(handles.wybor_plci, 'String')
- handles.sex = sex
- if sex == 'K'
- wspolczynnik = 0,6 ;
- else
- wspolczynnik = 0,7;
- end
- handles.wspolczynnik = wspolczynnik
- end
- % Hints: contents = cellstr(get(hObject,'String')) returns wybor_plci contents as cell array
- % contents{get(hObject,'Value')} returns selected item from wybor_plci
- % --- Executes during object creation, after setting all properties.
- function wybor_plci_CreateFcn(hObject, eventdata, handles)
- % hObject handle to wybor_plci (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles empty - handles not created until after all CreateFcns called
- % Hint: popupmenu 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
- end
- function waga_Callback(hObject, eventdata, handles)
- % hObject handle to waga (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- a = get(handles.waga, 'String')
- b = str2double(a)
- if sex ==K
- x = 0,6
- else
- x = 0,7
- end
- waga = b*x
- handles.waga = waga
- end
- % Hints: get(hObject,'String') returns contents of waga as text
- % str2double(get(hObject,'String')) returns contents of waga as a double
- % --- Executes during object creation, after setting all properties.
- function waga_CreateFcn(hObject, eventdata, handles)
- % hObject handle to waga (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
- end
- function wzrost_Callback(hObject, eventdata, handles)
- % hObject handle to masa (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- wzrost_zmienna = get(handles.wzrost, 'String')
- wzrost = str2double(wzrost_zmienna)
- handles.wzrost = wzrost
- end
- function [ilosc_plynow] = obliczilosc_plynow(waga,wzrost,wspolczynnik)
- BMI= waga/(wzrost/100)^2 ;
- if BMI >25
- z=BMI-25;
- y= z*3,0625
- elseif BMI<18,5
- z=18,5-BMI
- y = z*3,0625
- else
- y=BMI
- end
- waga_beztluszczu = waga-y;
- ilosc_plynow = waga_beztluszczu*wspolczynnik
- % Hints: get(hObject,'String') returns contents of masa as text
- % str2double(get(hObject,'String')) returns contents of masa as a double
- % --- Executes during object creation, after setting all properties.
- function wzrost_CreateFcn(hObject, eventdata, handles)
- % hObject handle to masa (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
- end
- function godzina_rozpoczecia_Callback(hObject, eventdata, handles)
- % hObject handle to godzina_rozpoczecia (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 godzina_rozpoczecia as text
- % str2double(get(hObject,'String')) returns contents of godzina_rozpoczecia as a double
- end
- % --- Executes during object creation, after setting all properties.
- function godzina_rozpoczecia_CreateFcn(hObject, eventdata, handles)
- % hObject handle to godzina_rozpoczecia (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
- end
- function edit6_Callback(hObject, eventdata, handles)
- % hObject handle to edit6 (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- end
- % Hints: get(hObject,'String') returns contents of edit6 as text
- %str2double(get(hObject,'String')) returns contents of edit6 as a double
- % --- Executes during object creation, after setting all properties.
- function edit6_CreateFcn(hObject, eventdata, handles)
- % hObject handle to edit6 (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
- end
- function czas_spozycia_Callback(hObject, eventdata, handles)
- % hObject handle to czas_spozycia (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 czas_spozycia as text
- % str2double(get(hObject,'String')) returns contents of czas_spozycia as a double
- end
- % --- Executes during object creation, after setting all properties.
- function czas_spozycia_CreateFcn(hObject, eventdata, handles)
- % hObject handle to czas_spozycia (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
- end
- function objetosc_piwa_Callback(hObject, eventdata, handles)
- % hObject handle to objetosc_piwa (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- objetosc_piwa =get(handles.objetosc_piwa,'String')
- objetosc_piwa1 = str2double(objetosc_piwa)
- handles.objetosc_piwa1 = objetosc_piwa1
- end
- function [masa_alkoholu_piwo] = obliczmase_alkoholu_piwo(objetosc_piwa1)
- q = 1,79
- objetosc_alkoholu = objetosc_piwa1*procent_piwa1
- masa_alkoholu_piwo = objetosc_alkoholu*q
- end
- % Hints: get(hObject,'String') returns contents of objetosc_piwa as text
- % str2double(get(hObject,'String')) returns contents of objetosc_piwa as a double
- % --- Executes during object creation, after setting all properties.
- function objetosc_piwa_CreateFcn(hObject, eventdata, handles)
- % hObject handle to objetosc_piwa (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
- end
- function objetosc_wina_Callback(hObject, eventdata, handles)
- % hObject handle to objetosc_wina (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- objetosc_wina =get(handles.objetosc_wina,'String')
- objetosc_wina1 = str2double(objetosc_wina)
- handles.objetosc_wina1 = objetosc_wina1
- end
- function [masa_alkoholu_wino] = obliczmase_alkoholu_wino(objetosc_wina1)
- q = 1,79
- objetosc_alkoholu = objetosc_wina1*procent_wina1
- masa_alkoholu_wino = objetosc_alkoholu*q
- end
- % Hints: get(hObject,'String') returns contents of objetosc_wina as text
- % str2double(get(hObject,'String')) returns contents of objetosc_wina as a double
- % --- Executes during object creation, after setting all properties.
- function objetosc_wina_CreateFcn(hObject, eventdata, handles)
- % hObject handle to objetosc_wina (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
- end
- function objetosc_wodki_Callback(hObject, eventdata, handles)
- % hObject handle to objetosc_wodki (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- objetosc_wodki =get(handles.objetosc_wodki,'String')
- objetosc_wodki1 = str2double(objetosc_wodki)
- handles.objetosc_wodki1 = objetosc_wodki1
- end
- function [masa_alkoholu_wodki] = obliczmase_alkoholu_wodki(objetosc_wodki1)
- q = 1,79
- objetosc_alkoholu = objetosc_wodki1*procent_piwa1
- masa_alkoholu_wodki = objetosc_alkoholu_wodki*q
- end
- % Hints: get(hObject,'String') returns contents of objetosc_wodki as text
- % str2double(get(hObject,'String')) returns contents of objetosc_wodki as a double
- % --- Executes during object creation, after setting all properties.
- function objetosc_wodki_CreateFcn(hObject, eventdata, handles)
- % hObject handle to objetosc_wodki (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
- end
- function procent_piwa_Callback(hObject, eventdata, handles)
- % hObject handle to procent_piwa (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- procent_piwa = get(handles.procent_piwa,'String')
- procent_piwa1 = str2double(procent_piwa)
- handles.procent_piwa1 = procent_piwa1
- end
- % Hints: get(hObject,'String') returns contents of procent_piwa as text
- % str2double(get(hObject,'String')) returns contents of procent_piwa as a double
- % --- Executes during object creation, after setting all properties.
- function procent_piwa_CreateFcn(hObject, eventdata, handles)
- % hObject handle to procent_piwa (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
- end
- function procent_wina_Callback(hObject, eventdata, handles)
- % hObject handle to procent_wina (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- procent_wina = get(handles.procent_wina,'String')
- procent_wina1 = str2double(procent_wina)
- handles.procent_wina1 = procent_wina1
- end
- % Hints: get(hObject,'String') returns contents of procent_wina as text
- % str2double(get(hObject,'String')) returns contents of procent_wina as a double
- % --- Executes during object creation, after setting all properties.
- function procent_wina_CreateFcn(hObject, eventdata, handles)
- % hObject handle to procent_wina (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
- end
- function procent_wodki_Callback(hObject, eventdata, handles)
- % hObject handle to procent_wodki (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- procent_wodki = get(handles.procent_wodki,'String')
- procent_wodki1 = str2double(procent_wodki)
- handles.procent_wodki1 = procent_wodki1
- end
- % Hints: get(hObject,'String') returns contents of procent_wodki as text
- % str2double(get(hObject,'String')) returns contents of procent_wodki as a double
- % --- Executes during object creation, after setting all properties.
- function procent_wodki_CreateFcn(hObject, eventdata, handles)
- % hObject handle to procent_wodki (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
- end
- masa_alkoholu_cala = masa_alkoholu_piwo + masa_alkoholu_wino + masa_alkoholu_wodki;
- szybkosc = 10*masa_alkoholu_cala/4,2+masa_alkoholu_cala;
- ilosc_promili = masa_alkoholu_cala/wspolczynnik*ilosc_plynow ;
- czas_trzezwienia = masa_alkoholu_cala / szybkosc ;
- % --- Executes on button press in oblicz_promile.
- function oblicz_promile_Callback(hObject, eventdata, handles)
- % hObject handle to oblicz_promile (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement