0% found this document useful (0 votes)
44 views

Código GEU PDF

This document contains code for a GUI created in MATLAB. The code defines functions for initializing the GUI, opening it, and handling button clicks and other events. It includes code for two screens or pages of the GUI.

Uploaded by

Luis Santos
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Código GEU PDF

This document contains code for a GUI created in MATLAB. The code defines functions for initializing the GUI, opening it, and handling button clicks and other events. It includes code for two screens or pages of the GUI.

Uploaded by

Luis Santos
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 81

Cdigo da avaliadora generalizada de incertezas:

Autores: Ricardo de Arajo Kalid Gesner Andrade Nery Jnior Guilherme Augusto de Almeida Gonalves Lucas Aguiar Teixeira Data: 17/01/2010 Tela 01
function varargout = tela_01_inicial(varargin) % TELA_01_INICIAL M-file for tela_01_inicial.fig % TELA_01_INICIAL, by itself, creates a new TELA_01_INICIAL or raises the existing % singleton*. % % H = TELA_01_INICIAL returns the handle to a new TELA_01_INICIAL or the handle to % the existing singleton*. % % TELA_01_INICIAL('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in TELA_01_INICIAL.M with the given input arguments. % % TELA_01_INICIAL('Property','Value',...) creates a new TELA_01_INICIAL or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before tela_01_inicial_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to tela_01_inicial_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 tela_01_inicial % Last Modified by GUIDE v2.5 07-Apr-2009 17:13:04

% Begin initialization code - DO NOT gui_Singleton = 1; gui_State = struct('gui_Name', 'gui_Singleton', 'gui_OpeningFcn',

EDIT mfilename, ... gui_Singleton, ... @tela_01_inicial_OpeningFcn, ...

'gui_OutputFcn', @tela_01_inicial_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 tela_01_inicial is made visible. function tela_01_inicial_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 tela_01_inicial (see VARARGIN)

% Choose default command line output for tela_01_inicial handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes tela_01_inicial wait for user response (see UIRESUME) % uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line. function varargout = tela_01_inicial_OutputFcn(hObject, eventdata, handles) a=imread('nano.jpg','jpeg'); IconData=a; %questIconMap(256,:) = get(handles.figure1, 'Color'); % IconCMap=a; Img=image(IconData, 'Parent', handles.axes1); %set(handles.figure1, 'Colormap', IconCMap); set(handles.axes1, ... 'Visible', 'off', ... 'YDir' , 'reverse' , ... 'XLim' , get(Img,'XData'), ... 'YLim' , get(Img,'YData') ... ); % Make the GUI modal set(handles.figure1,'WindowStyle','modal') % UIWAIT makes untitled2 wait for user response (see UIRESUME) uiwait(handles.figure1);

% % % %

varargout hObject eventdata handles

cell array for returning output args (see VARARGOUT); handle to figure reserved - to be defined in a future version of MATLAB 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) close clear all run('tela_02_medicao') % 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)

Tela 02
function varargout = tela_02_medicao(varargin) % TELA_02_MEDICAO M-file for tela_02_medicao.fig % TELA_02_MEDICAO, by itself, creates a new TELA_02_MEDICAO or raises the existing % singleton*. % % H = TELA_02_MEDICAO returns the handle to a new TELA_02_MEDICAO or the handle to % the existing singleton*. % % TELA_02_MEDICAO('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in TELA_02_MEDICAO.M with the given input arguments. % % TELA_02_MEDICAO('Property','Value',...) creates a new TELA_02_MEDICAO or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before tela_02_medicao_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to tela_02_medicao_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 tela_02_medicao % Last Modified by GUIDE v2.5 11-Apr-2008 15:10:50

% Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @tela_02_medicao_OpeningFcn, ... 'gui_OutputFcn', @tela_02_medicao_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 tela_02_medicao is made visible. function tela_02_medicao_OpeningFcn(hObject, eventdata, handles, varargin) global medicao nc metodo significativo % 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 tela_02_medicao (see VARARGIN) % Choose default command line output for tela_02_medicao handles.output = hObject; % Update handles structure guidata(hObject, handles); if isempty(medicao)~=1 if medicao==1 set(handles.radiobutton1,'Value',1) elseif medicao==0 set(handles.radiobutton2,'Value',1) end end if isempty(significativo)~=1 if significativo==1 set(handles.radiobutton5,'Value',1) elseif significativo==0 set(handles.radiobutton6,'Value',1) end end if isempty(nc)~=1 set(handles.edit1,'String',nc); end if isempty(metodo)~=1 set(handles.checkbox1,'Value',metodo(1)); set(handles.checkbox2,'Value',metodo(2)); end % UIWAIT makes tela_02_medicao wait for user response (see UIRESUME) % uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line. function varargout = tela_02_medicao_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 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

% --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) run('help_02_nivelconfianca') % 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)

% --- Executes on button press in radiobutton1. function radiobutton1_Callback(hObject, eventdata, handles) set(handles.radiobutton2, 'Value', 0) set(handles.radiobutton1, 'Value', 1) % hObject handle to radiobutton1 (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 radiobutton1

% --- Executes on button press in radiobutton2.

function radiobutton2_Callback(hObject, eventdata, handles) set(handles.radiobutton1, 'Value', 0) set(handles.radiobutton2, 'Value', 1) % hObject handle to radiobutton2 (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 radiobutton2

% --- Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) global medicao nc metodo significativo pular_tela %guilherme 30/06/10 pular_tela = get(handles.checkbox4,'Value'); % GIGA 02/09%%%% if (get(handles.radiobutton1,'Value')==0)&&(get(handles.radiobutton2,'Val ue')==0) errordlg('Voc deve escolher uma opo de ''tipo de medio!''') return elseif (get(handles.radiobutton5,'Value')==0)&&(get(handles.radiobutton6,'Val ue')==0) errordlg('Voc deve escolher uma opo de ''nmero de algarismos significativos da incerteza''!') return elseif (get(handles.checkbox1,'Value')==0&&get(handles.checkbox2,'Value')==0) errordlg('Voc deve escolher uma opo de ''mtodo de avaliao da incerteza''!') return end if isempty(get(handles.edit1,'String')) errordlg('Insira um valor para o nvel de confiana!') return end if (~isempty(find(get(handles.edit1,'String')==44,1))) errordlg('Neste programa usa-se ponto ''.'' para separar as casas decimais! No use vrgulas '','' !') return end if ~isanumber(get(handles.edit1,'String')) errordlg('O nvel de confiana precisa ser um nmero!') return end if eval(get(handles.edit1,'String'))>=100 errordlg('O nvel de confiana precisa ser um nmero menor que 100% ! Trabalha-se com Porcentagem!') return end

if eval(get(handles.edit1,'String'))<=0 errordlg('O nvel de confiana no pode ser zero nem um nmero negativo!') return end

% GIGA 02/09%%% nc=get(handles.edit1,'String'); medicao=get(handles.radiobutton1,'Value'); metodo=[get(handles.checkbox1,'Value') get(handles.checkbox2,'Value')]; significativo=get(handles.radiobutton6,'Value'); close run('tela_03_entrada_de_dados')

% hObject % eventdata % handles

handle to pushbutton2 (see GCBO) reserved - to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA)

% --- Executes on button press in radiobutton3. function radiobutton3_Callback(hObject, eventdata, handles) % hObject handle to radiobutton3 (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 radiobutton3

% --- Executes on button press in radiobutton4. function radiobutton4_Callback(hObject, eventdata, handles) % hObject handle to radiobutton4 (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 radiobutton4

% --- Executes on button press in checkbox1. function checkbox1_Callback(hObject, eventdata, handles) % hObject handle to checkbox1 (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 checkbox1

% --- Executes on button press in checkbox2.

function checkbox2_Callback(hObject, eventdata, handles) % hObject handle to checkbox2 (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 checkbox2

% --- Executes on button press in radiobutton5. function radiobutton5_Callback(hObject, eventdata, handles) set(handles.radiobutton5, 'Value', 1) set(handles.radiobutton6, 'Value', 0) % hObject handle to radiobutton5 (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 radiobutton5

% --- Executes on button press in radiobutton6. function radiobutton6_Callback(hObject, eventdata, handles) set(handles.radiobutton5, 'Value', 0) set(handles.radiobutton6, 'Value', 1) % hObject handle to radiobutton6 (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 radiobutton6

% --- Executes on button press in checkbox3. function checkbox3_Callback(hObject, eventdata, handles) %guilherme 01/04/10 global pular_tela pular_tela = get(handles.checkbox3,'Value'); % hObject handle to checkbox3 (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 checkbox3

% --- Executes on button press in checkbox4. function checkbox4_Callback(hObject, eventdata, handles) % hObject handle to checkbox4 (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 checkbox4 estado = get(handles.checkbox4,'Value'); if estado ==1;

warndlg('Ao marcar esta caixa no ser realizado o mtodo de Monte Carlo, devido falta de informaes precisas a respeito das PDFs combinadas das grandezas de entrada') set(handles.checkbox2,'Value',0) set(handles.checkbox2,'Enable','Off') end if estado ==0; set(handles.checkbox2,'Value',1) set(handles.checkbox2,'Enable','On') end tela 03 function varargout = tela_03_entrada_de_dados(varargin) % TELA_03_ENTRADA_DE_DADOS M-file for tela_03_entrada_de_dados.fig % TELA_03_ENTRADA_DE_DADOS, by itself, creates a new TELA_03_ENTRADA_DE_DADOS or raises the existing % singleton*. % % H = TELA_03_ENTRADA_DE_DADOS returns the handle to a new TELA_03_ENTRADA_DE_DADOS or the handle to % the existing singleton*. % % TELA_03_ENTRADA_DE_DADOS('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in TELA_03_ENTRADA_DE_DADOS.M with the given input arguments. % % TELA_03_ENTRADA_DE_DADOS('Property','Value',...) creates a new TELA_03_ENTRADA_DE_DADOS or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before tela_03_entrada_de_dados_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to tela_03_entrada_de_dados_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 tela_03_entrada_de_dados % Last Modified by GUIDE v2.5 23-Sep-2009 14:16:13 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @tela_03_entrada_de_dados_OpeningFcn, ... 'gui_OutputFcn', @tela_03_entrada_de_dados_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 tela_03_entrada_de_dados is made visible. function tela_03_entrada_de_dados_OpeningFcn(hObject, eventdata, handles, varargin) global variaveis medicao pular_tela medicao %GUILHERME 01/05/10 if pular_tela ==1 set(handles.checkbox1,'Value',1) %set([handles.checkbox1],'Enable','off') end if pular_tela==1 set(handles.text11,'String','Incerteza padro combinada') set(handles.edit8,'Enable','Off') if get(handles.radiobutton6,'Value')==1 set(handles.edit5,'Enable','On') set(handles.radiobutton6,'Value',1) end set(handles.radiobutton5,'Enable','On') set(handles.radiobutton6,'Enable','Off') set(handles.text6,'String','Graus de liberdade efetivo:') set(handles.radiobutton5,'Value',1) set(handles.radiobutton6,'Value',0) else set(handles.text11,'String','Desvio padro experimental da mdia (desvio da mdia)') set(handles.edit8,'Enable','On') set(handles.radiobutton5,'Enable','On') set(handles.text6,'String','Nmero de medidas:') set(handles.radiobutton6,'Enable','On') end %GUILHERME EM 30/09 IMPLEMENTANDO SUGESTO DE CAMILA if pular_tela == 0 set(handles.edit1,'Enable','Off') set(handles.edit3,'Enable','Off') set(handles.edit2,'Enable','Off') set(handles.edit4,'Enable','Off') set(handles.edit5,'Enable','Off') set(handles.edit8,'Enable','Off') set(handles.edit6,'Enable','Off') set(handles.edit7,'Enable','Off') set(handles.edit9,'Enable','Off') set(handles.edit11,'Enable','Off') set(handles.radiobutton5,'Enable','Off') set(handles.radiobutton6,'Enable','Off') set(handles.checkbox1,'Enable','Off') set(handles.radiobutton1, 'Value', 0) set(handles.radiobutton3, 'Value', 0) set(handles.radiobutton2, 'Value', 0) set(handles.edit9,'String','1') set(handles.edit11,'string','1')

end %soluo problema da combinada if pular_tela ==1 set(handles.checkbox1,'Value',1) set(handles.text4,'String','Mdia da varivel') %mudana polmica em 20/10/2010 incerteza padro combinada set(handles.radiobutton1, 'Value', 1) set(handles.radiobutton3, 'Value', 0) set(handles.radiobutton2, 'Value', 0) set(handles.radiobutton3, 'Enable', 'Off') set(handles.radiobutton2, 'Enable', 'Off') %set([handles.checkbox1],'Enable','off') end if pular_tela==1 set(handles.text11,'String','Incerteza padro combinada') set(handles.edit8,'Enable','Off') if get(handles.radiobutton6,'Value')==1 set(handles.edit5,'Enable','On') set(handles.radiobutton6,'Value',1) end set(handles.radiobutton5,'Enable','On') set(handles.radiobutton6,'Enable','Off') set(handles.text6,'String','Graus de liberdade efetivo:') set(handles.radiobutton5,'Value',1) set(handles.radiobutton6,'Value',0) else set(handles.text11,'String','Desvio padro experimental da mdia (desvio da mdia)') set(handles.edit8,'Enable','On') set(handles.radiobutton5,'Enable','On') set(handles.text6,'String','Nmero de medidas:') set(handles.radiobutton6,'Enable','On') end %GIGA 02/09 set([handles.radiobutton5],'Value',1) set([handles.edit8],'Enable','off') %GIGA 02/09

% 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 tela_03_entrada_de_dados (see VARARGIN) % Choose default command line output for tela_03_entrada_de_dados handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes tela_03_entrada_de_dados wait for user response (see UIRESUME) % uiwait(handles.figure1); if isempty(variaveis)~=1 set(handles.listbox1,'String',variaveis.nome) if medicao==1

set([handles.pushbutton1],'Enable','off')%desativA o boto de add set([handles.pushbutton2],'Enable','on') %ativA o boto de remover end end % --- Outputs from this function are returned to the command line. function varargout = tela_03_entrada_de_dados_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 pushbutton3. function pushbutton3_Callback(hObject, eventdata, handles) run('help_03_qualfdp') % hObject handle to pushbutton3 (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 pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) global n variaveis medicao pular_tela

%GIGA 02/09 botao=get(handles.radiobutton5, 'Value'); % TESTES DE ERRO if (isempty(get(handles.edit1,'String'))||isempty(get(handles.edit2,'Stri ng'))... ||isempty(get(handles.edit3,'String'))||isempty(get(handles.edit4,'Str ing'))... ||isempty(get(handles.edit6,'String'))||isempty(get(handles.edit7,'Str ing')))... ||isempty(get(handles.edit11,'String'))||isempty(get(handles.edit9,'St ring')) errordlg('Todas as lacunas devem ser preenchidas para adicionar a grandeza!') return end if botao==1 if isempty(get(handles.edit5,'String')) errordlg('Todas as lacunas devem ser preenchidas para adicionar a grandeza!') return end else

if isempty(get(handles.edit8,'String')) errordlg('Todas as lacunas devem ser preenchidas para adicionar a grandeza!') return end end if (~isempty(find(get(handles.edit4,'String') == 44, 1))||~isempty(find(get(handles.edit6,'String') == 44, 1))... ||~isempty(find(get(handles.edit7,'String') == 44, 1))||~isempty(find(get(handles.edit9,'String') == 44, 1))) errordlg('Neste programa usa-se ponto ''.'' para separar as casas decimais! No use vrgulas '','' !') return end if botao==1 if ~isempty(find(get(handles.edit5,'String') == 44, 1)) errordlg('Neste programa usa-se ponto ''.'' para separar as casas decimais! No use vrgulas '','' !') return end else if ~isempty(find(get(handles.edit8,'String') == 44, 1)) errordlg('Neste programa usa-se ponto ''.'' para separar as casas decimais! No use vrgulas '','' !') return end end if ~isanumber(get(handles.edit6,'String'))||~isanumber(get(handles.edit4, 'String'))... ||~isanumber(get(handles.edit7,'String'))||~isanumber(get(handles.edit 9,'String')) errordlg('Mdia da grandeza, Desvio padro experimental da mdia (ou da amostra) ou Limite Superior, Nmero de medidas (ou Graus de Liberdade Efetivos), Correo e Coeficiente de Sensibilidade precisam ser nmeros!') return end if botao==1 if ~isanumber(get(handles.edit5,'String')) errordlg('Mdia da grandeza, Desvio padro experimental da mdia (ou da amostra) ou Limite Superior, Nmero de medidas (ou Graus de Liberdade Efetivos), Correo e Coeficiente de Sensibilidade precisam ser nmeros!') return end else if ~isanumber(get(handles.edit8,'String'))

errordlg('Mdia da grandeza, Desvio padro experimental da mdia (ou da amostra) ou Limite Superior, Nmero de medidas (ou Graus de Liberdade Efetivos), Correo e Coeficiente de Sensibilidade precisam ser nmeros!') return end end

if eval(get(handles.edit6,'String')) <= 1 errordlg(' necessrio um nmero de medidas maior que 1!') return elseif (eval(get(handles.edit6,'String'))floor(eval(get(handles.edit6,'String'))))~= 0 if ~strcmp('inf',get(handles.edit6,'String')) errordlg('No existe nmero de medida fracionado!') return end end % TESTES DE ERRO %GIGA 02/09

if isempty(n)==1 n=0; end n=n+1; variaveis.nome(n)={get(handles.edit1,'String')}; variaveis.unidade(n)={get(handles.edit3,'String')}; variaveis.simbolo(n)={get(handles.edit2,'String')}; variaveis.media(n)={get(handles.edit4,'String')}; variaveis.medidas(n)={get(handles.edit6,'String')}; variaveis.sensibilidade(n)={get(handles.edit9,'String')}; variaveis.unit_sensibilidade(n)={get(handles.edit11,'String')}; if botao==1 variaveis.desvio(n)={get(handles.edit5,'String')}; else variaveis.desvio(n)={num2str(str2num(get(handles.edit8,'String'))/sqrt (str2num(get(handles.edit6,'String'))))}; %variaveis.desvio(n) = num2str(variaveis.desvio(n)); end variaveis.fdp(n)={find([get(handles.radiobutton1,'Value'),get(handles. radiobutton2,'Value'),... get(handles.radiobutton3,'Value')])}; % o valor 1 representa gaussiana, 2 triangular e 3 retangular variaveis.correcao(n)={get(handles.edit7,'String')}; variaveis.media(n)={num2str(str2double(variaveis.sensibilidade(n))*(st r2double(cell2mat(variaveis.media(n)))+str2double(cell2mat(variaveis.c orrecao(n)))))}; %fazendo a correcao set(handles.listbox1,'String',variaveis.nome)

% 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) if n>0 set([handles.pushbutton2],'Enable','on') end set(handles.edit1,'string','') set(handles.edit2,'string','') set(handles.edit3,'string','') set(handles.edit4,'string','') set(handles.edit5,'string','') set(handles.edit6,'string','') set(handles.edit7,'string','') set(handles.edit8,'string','') %GIGA 6/10 %%% set(handles.edit9,'String','1') set(handles.edit11,'string','1') %GIGA 6/10 %%% if medicao==1 close run('tela_04_incerteza_tipoB') else %guilherme if pular_tela == 0 set(handles.edit1,'Enable','Off') set(handles.edit3,'Enable','Off') set(handles.edit2,'Enable','Off') set(handles.edit4,'Enable','Off') set(handles.edit5,'Enable','Off') set(handles.edit8,'Enable','Off') set(handles.edit6,'Enable','Off') set(handles.edit7,'Enable','Off') set(handles.edit9,'Enable','Off') set(handles.edit11,'Enable','Off') set(handles.radiobutton5,'Enable','Off') set(handles.radiobutton6,'Enable','Off') set(handles.checkbox1,'Value',0) set(handles.checkbox1,'Enable','Off') set(handles.radiobutton1, 'Value', 0) set(handles.radiobutton3, 'Value', 0) set(handles.radiobutton2, 'Value', 0) set(handles.radiobutton1, 'Enable', 'On') set(handles.radiobutton3, 'Enable', 'On') set(handles.radiobutton2, 'Enable', 'On') end if pular_tela ==1 set(handles.checkbox1,'Value',1) set(handles.text4,'String','Mdia da varivel') %mudana polmica em 20/10/2010 incerteza padro combinada set(handles.radiobutton1, 'Value', 1) set(handles.radiobutton3, 'Value', 0) set(handles.radiobutton2, 'Value', 0) set(handles.radiobutton3, 'Enable', 'Off') set(handles.radiobutton2, 'Enable', 'Off') %set([handles.checkbox1],'Enable','off') end if pular_tela==1

set(handles.text11,'String','Incerteza padro combinada') set(handles.edit8,'Enable','Off') if get(handles.radiobutton6,'Value')==1 set(handles.edit5,'Enable','On') set(handles.radiobutton6,'Value',1) end set(handles.radiobutton5,'Enable','On') set(handles.radiobutton6,'Enable','Off') set(handles.text6,'String','Graus de liberdade efetivo:') set(handles.radiobutton5,'Value',1) set(handles.radiobutton6,'Value',0) else set(handles.text11,'String','Desvio padro experimental da mdia (desvio da mdia)') set(handles.edit8,'Enable','Off') set(handles.radiobutton5,'Enable','On') set(handles.text6,'String','Nmero de medidas:') set(handles.radiobutton6,'Enable','On') end end % --- Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles) global n variaveis if isempty(n)==0 n=n-1; end currentVal = get(handles.listbox1,'Value'); %guilherme %este comando pega o valor que est selecionado no listbox um nmero de 1 ao nmero de variveis adcionadas resultsStr = get(handles.listbox1,'String'); %este comando pega a varivel que armazena os nomes do listbox numResults = size(resultsStr,1); %este comando clcula o nmero de variveis que temos no listbox %------------------------------------------------------------------------%REMOVENDO OS VALORES DO LISTBOX E DA VARIAVEL % Remove the data and list entry for the selected value resultsStr(currentVal) =[]; %transforma em vazio o local do listbox selecionado variaveis.nome(currentVal)=[]; variaveis.unidade(currentVal)=[]; variaveis.simbolo(currentVal)=[]; variaveis.media(currentVal)=[]; variaveis.desvio(currentVal)=[]; variaveis.medidas(currentVal)=[]; variaveis.fdp(currentVal)=[]; variaveis.correcao(currentVal)=[]; %exclui o resultado da varvel que armazena os resultados %-----------------------------------------------------------------------%DESABILITANDO O BOTO SE NO TEMOS MAIS VARIVEIS A SER REMOVIDAS %MUDA A LISTA DE STRINGS PARA VAZIO if isequal(numResults,length(currentVal)),%se for igual o nmero de variveis a 1 resultsStr = {'<empty>'};%esvazia o listbox currentVal = 1;% e faz o valor selecionado igual a 1 set([handles.pushbutton2],'Enable','off')%desativA o boto de remove set([handles.pushbutton1],'Enable','on') end

%----------------------------------------------------------------------%TRANSFORMA O CURRENTVAL(NMERO INTEIRO QUE CORRESPONDE A VALUE)NO MENOR %VALOR ENTRE O ANTIGO VALUE E O TAMANHO DO STRING QUE EST NO LISTBOX (NMERO DE VARIVEIS) currentVal = min(currentVal,size(resultsStr,1)); %------------------------------------------------------------------------set(handles.listbox1,'Value',currentVal,'String',resultsStr) % hObject % eventdata % handles handle to pushbutton2 (see GCBO) reserved - to be defined in a future version of MATLAB 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 selection change in listbox1. function listbox1_Callback(hObject, eventdata, handles) % hObject handle to listbox1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns listbox1 contents as cell array % contents{get(hObject,'Value')} returns selected item from listbox1

% --- Executes during object creation, after setting all properties. function listbox1_CreateFcn(hObject, eventdata, handles) % hObject handle to listbox1 (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

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

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

% --- Executes during object creation, after setting all properties. function edit5_CreateFcn(hObject, eventdata, handles) % hObject handle to edit5 (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 edit6_Callback(hObject, eventdata, handles) % hObject handle to edit6 (see GCBO)

% eventdata % handles

reserved - to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA)

% 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

% --- Executes on button press in radiobutton1. function radiobutton1_Callback(hObject, eventdata, handles) global pular_tela %GUILHERME EM 27/10/2010 %GUILHERME 30/09 if pular_tela == 0 set(handles.edit1,'Enable','On') set(handles.edit3,'Enable','On') set(handles.edit2,'Enable','On') set(handles.edit4,'Enable','On') set(handles.edit5,'Enable','On') set(handles.edit8,'Enable','Off') set(handles.edit6,'Enable','On') set(handles.edit7,'Enable','On') set(handles.edit9,'Enable','On') set(handles.edit11,'Enable','On') set(handles.radiobutton5,'Enable','On') set(handles.radiobutton6,'Enable','On') set(handles.checkbox1,'Enable','On') %--------------------------------------------------set(handles.radiobutton2, 'Value', 0) set(handles.radiobutton3, 'Value', 0) set(handles.radiobutton1, 'Value', 1) set(handles.edit4,'String','') set(handles.edit11,'String','') set(handles.text4,'String','Mdia da varivel') set(handles.text11,'String','Desvio padro experimental da mdia (desvio da mdia)') set(handles.radiobutton6,'Enable','On') set(handles.edit9,'String','1') set(handles.edit11,'string','1') end if pular_tela ==1 set(handles.checkbox1,'Value',1)

set(handles.text4,'String','Mdia da varivel') %mudana polmica em 20/10/2010 incerteza padro combinada set(handles.radiobutton1, 'Value', 1) set(handles.radiobutton3, 'Value', 0) set(handles.radiobutton2, 'Value', 0) set(handles.radiobutton3, 'Enable', 'Off') set(handles.radiobutton2, 'Enable', 'Off') %set([handles.checkbox1],'Enable','off') end if pular_tela==1 set(handles.text11,'String','Incerteza padro combinada') set(handles.edit8,'Enable','Off') if get(handles.radiobutton6,'Value')==1 set(handles.edit5,'Enable','On') set(handles.radiobutton6,'Value',1) end set(handles.radiobutton5,'Enable','On') set(handles.radiobutton6,'Enable','Off') set(handles.text6,'String','Graus de liberdade efetivo:') set(handles.radiobutton5,'Value',1) set(handles.radiobutton6,'Value',0) % else % set(handles.text11,'String','Desvio padro experimental da mdia (desvio da mdia)') % set(handles.edit8,'Enable','On') % set(handles.radiobutton5,'Enable','On') % set(handles.text6,'String','Nmero de medidas:') % set(handles.radiobutton6,'Enable','On') end % hObject handle to radiobutton1 (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 radiobutton1

% --- Executes on button press in radiobutton2. function radiobutton2_Callback(hObject, eventdata, handles) global pular_tela %GUILHERME 30/09/10 if pular_tela ==0 set(handles.edit1,'Enable','On') set(handles.edit3,'Enable','On') set(handles.edit2,'Enable','On') set(handles.edit4,'Enable','On') set(handles.edit5,'Enable','On') set(handles.edit8,'Enable','Off') set(handles.edit6,'Enable','On') set(handles.edit7,'Enable','On') set(handles.edit9,'Enable','On') set(handles.edit11,'Enable','On') set(handles.radiobutton5,'Enable','On') set(handles.radiobutton6,'Enable','On') set(handles.checkbox1,'Enable','On') set(handles.checkbox1,'Value',0) %---------------------------------------set(handles.radiobutton2, 'Value', 1) set(handles.radiobutton3, 'Value', 0)

set(handles.radiobutton1, 'Value', 0) set(handles.edit4,'String','') set(handles.edit11,'String','') set(handles.text4,'String','Limite Superior') set(handles.text11,'String','Limite Inferior') set(handles.radiobutton6,'Enable','Off') set(handles.edit9,'String','1') set(handles.edit11,'string','1') end %GUILHERME EM 27/10/2010 if pular_tela ==1 set(handles.checkbox1,'Value',1) set(handles.text4,'String','Mdia da varivel') %mudana polmica em 20/10/2010 incerteza padro combinada set(handles.radiobutton1, 'Value', 1) set(handles.radiobutton3, 'Value', 0) set(handles.radiobutton2, 'Value', 0) set(handles.radiobutton3, 'Enable', 'Off') set(handles.radiobutton2, 'Enable', 'Off') %set([handles.checkbox1],'Enable','off') end if pular_tela==1 set(handles.text11,'String','Incerteza padro combinada') set(handles.edit8,'Enable','Off') if get(handles.radiobutton6,'Value')==1 set(handles.edit5,'Enable','On') set(handles.radiobutton6,'Value',1) end set(handles.radiobutton5,'Enable','On') set(handles.radiobutton6,'Enable','Off') set(handles.text6,'String','Graus de liberdade efetivo:') set(handles.radiobutton5,'Value',1) set(handles.radiobutton6,'Value',0) % else % set(handles.text11,'String','Desvio padro experimental da mdia (desvio da mdia)') % set(handles.edit8,'Enable','On') % set(handles.radiobutton5,'Enable','On') % set(handles.text6,'String','Nmero de medidas:') % set(handles.radiobutton6,'Enable','On') end % hObject % eventdata % handles handle to radiobutton2 (see GCBO) reserved - to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA)

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

% --- Executes on button press in radiobutton3. function radiobutton3_Callback(hObject, eventdata, handles) global pular_tela %GUILHERME EM 27/10/2010 %GUILHERME 30/09/10 if pular_tela ==1 set(handles.checkbox1,'Value',1) set(handles.text4,'String','Mdia da varivel') %mudana polmica em 20/10/2010 incerteza padro combinada

set(handles.radiobutton1, 'Value', 1) set(handles.radiobutton3, 'Value', 0) set(handles.radiobutton2, 'Value', 0) set(handles.radiobutton3, 'Enable', 'Off') set(handles.radiobutton2, 'Enable', 'Off') %set([handles.checkbox1],'Enable','off') else set(handles.edit1,'Enable','On') set(handles.edit3,'Enable','On') set(handles.edit2,'Enable','On') set(handles.edit4,'Enable','On') set(handles.edit5,'Enable','On') set(handles.edit8,'Enable','Off') set(handles.edit6,'Enable','On') set(handles.edit7,'Enable','On') set(handles.edit9,'Enable','On') set(handles.edit11,'Enable','On') set(handles.radiobutton5,'Enable','On') set(handles.radiobutton6,'Enable','On') set(handles.checkbox1,'Enable','On') %------------------------------------------set(handles.radiobutton1, 'Value', 0) set(handles.radiobutton3, 'Value', 1) set(handles.radiobutton2, 'Value', 0) set(handles.edit4,'String','') set(handles.edit11,'String','') set(handles.text4,'String','Limite Superior') set(handles.text11,'String','Limite Inferior') set(handles.radiobutton6,'Enable','Off') set(handles.edit9,'String','1') set(handles.edit11,'string','1') end if pular_tela==1 set(handles.text11,'String','Incerteza padro combinada') set(handles.edit8,'Enable','Off') if get(handles.radiobutton6,'Value')==1 set(handles.edit5,'Enable','On') set(handles.radiobutton6,'Value',1) end set(handles.radiobutton5,'Enable','On') set(handles.radiobutton6,'Enable','Off') set(handles.text6,'String','Graus de liberdade efetivo:') set(handles.radiobutton5,'Value',1) set(handles.radiobutton6,'Value',0) % else % set(handles.text11,'String','Desvio padro experimental da mdia (desvio da mdia)') % set(handles.edit8,'Enable','On') % set(handles.radiobutton5,'Enable','On') % set(handles.text6,'String','Nmero de medidas:') % set(handles.radiobutton6,'Enable','On') end % hObject handle to radiobutton3 (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 radiobutton3

% --- Executes on button press in pushbutton4. function pushbutton4_Callback(hObject, eventdata, handles)

global variaveis pular_tela if isempty(variaveis)==1 errordlg(' preciso adicionar pelo menos uma varivel de entrada!') return end if isempty(get(handles.edit1,'String'))==0 errordlg('Adicione a grandeza apertando o boto "Adicionar Grandeza" Caso no queira adicionar essa grandeza, apague o nome e siga com o programa.') return end close if pular_tela==0 run('tela_04_incerteza_tipoB') else run('tela_05_modelo') end % hObject % eventdata % handles handle to pushbutton4 (see GCBO) reserved - to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA)

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

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

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

% --- Executes during object creation, after setting all properties. function edit8_CreateFcn(hObject, eventdata, handles) % hObject handle to edit8 (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 radiobutton5. function radiobutton5_Callback(hObject, eventdata, handles) % hObject handle to radiobutton5 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.radiobutton5, 'Value', 1) set(handles.radiobutton6, 'Value', 0) set(handles.edit5, 'Enable', 'on') set(handles.edit8, 'Enable', 'off') % Hint: get(hObject,'Value') returns toggle state of radiobutton5

% --- Executes on button press in radiobutton6. function radiobutton6_Callback(hObject, eventdata, handles) set(handles.radiobutton5, 'Value', 0) set(handles.radiobutton6, 'Value', 1) set(handles.edit5, 'Enable', 'off') set(handles.edit8, 'Enable', 'on') % hObject handle to radiobutton6 (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 radiobutton6

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

% --- Executes during object creation, after setting all properties. function edit9_CreateFcn(hObject, eventdata, handles) % hObject handle to edit9 (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 checkbox1. function checkbox1_Callback(hObject, eventdata, handles) global pular_tela if pular_tela ==1 set(handles.checkbox1,'Value',1) errordlg('Voc escolheu na tela anterior entrar para todas as grandezas com a incerteza padro combinada!') %mudana polmica da incerteza padro combinada set(handles.radiobutton1, 'Value', 1) set(handles.radiobutton3, 'Value', 0) set(handles.radiobutton2, 'Value', 0) set(handles.radiobutton3, 'Enable', 'Off') set(handles.radiobutton2, 'Enable', 'Off') %set([handles.checkbox1],'Enable','off') end if get(handles.checkbox1,'Value')==1 set(handles.text11,'String','Incerteza padro combinada') set(handles.edit8,'Enable','Off') %mudana polmica set(handles.radiobutton1, 'Value', 1) set(handles.radiobutton3, 'Value', 0) set(handles.radiobutton2, 'Value', 0) set(handles.radiobutton3, 'Enable', 'Off') set(handles.radiobutton2, 'Enable', 'Off') if get(handles.radiobutton6,'Value')==1 set(handles.edit5,'Enable','On')

set(handles.radiobutton6,'Value',1) end set(handles.radiobutton5,'Enable','On') set(handles.radiobutton6,'Enable','Off') set(handles.text6,'String','Graus de liberdade efetivo:') set(handles.text4,'String','Mdia da grandeza') set(handles.radiobutton6,'Value',0) else set(handles.text11,'String','Desvio padro experimental da mdia (desvio da mdia)') set(handles.edit8,'Enable','On') set(handles.radiobutton5,'Enable','On') set(handles.text6,'String','Nmero de medidas:') set(handles.radiobutton6,'Enable','On') %mudana polmica continuao 28/10 set(handles.radiobutton1, 'Value', 1) set(handles.radiobutton3, 'Value', 0) set(handles.radiobutton2, 'Value', 0) set(handles.radiobutton3, 'Enable', 'On') set(handles.radiobutton2, 'Enable', 'On') end % hObject % eventdata % handles handle to checkbox1 (see GCBO) reserved - to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA)

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

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

% --- Executes during object creation, after setting all properties. function edit11_CreateFcn(hObject, eventdata, handles) % hObject handle to edit11 (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 edit12_Callback(hObject, eventdata, handles)

% hObject % eventdata % handles

handle to edit5 (see GCBO) reserved - to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit5 as text % str2double(get(hObject,'String')) returns contents of edit5 as a double

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

% --- Executes during object creation, after setting all properties. function edit13_CreateFcn(hObject, eventdata, handles) % hObject handle to edit8 (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 radiobutton5. function radiobutton7_Callback(hObject, eventdata, handles) % hObject handle to radiobutton5 (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 radiobutton5

% --- Executes on button press in radiobutton6. function radiobutton8_Callback(hObject, eventdata, handles) % hObject handle to radiobutton6 (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 radiobutton6

% --- Executes on button press in pushbutton6. function pushbutton6_Callback(hObject, eventdata, handles) run('help_coeficiente_de_sensibilidade') % hObject handle to pushbutton6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) Tela 04 function varargout = tela_04_incerteza_tipoB(varargin) % TELA_04_INCERTEZA_TIPOB M-file for tela_04_incerteza_tipoB.fig % TELA_04_INCERTEZA_TIPOB, by itself, creates a new TELA_04_INCERTEZA_TIPOB or raises the existing % singleton*. % % H = TELA_04_INCERTEZA_TIPOB returns the handle to a new TELA_04_INCERTEZA_TIPOB or the handle to % the existing singleton*. % % TELA_04_INCERTEZA_TIPOB('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in TELA_04_INCERTEZA_TIPOB.M with the given input arguments. % % TELA_04_INCERTEZA_TIPOB('Property','Value',...) creates a new TELA_04_INCERTEZA_TIPOB or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before tela_04_incerteza_tipoB_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to tela_04_incerteza_tipoB_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 tela_04_incerteza_tipoB % Last Modified by GUIDE v2.5 23-Sep-2009 11:03:30

% Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @tela_04_incerteza_tipoB_OpeningFcn, ... 'gui_OutputFcn', @tela_04_incerteza_tipoB_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 tela_04_incerteza_tipoB is made visible. function tela_04_incerteza_tipoB_OpeningFcn(hObject, eventdata, handles, varargin) global list variaveis % 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 tela_04_incerteza_tipoB (see VARARGIN) % Choose default command line output for tela_04_incerteza_tipoB handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes tela_04_incerteza_tipoB wait for user response (see UIRESUME) % uiwait(handles.figure1); if isempty(list)~=1 eval(['set(handles.listbox2,' '''String''' ',list.' cell2mat(variaveis.simbolo(1)) ')']) end

% --- Outputs from this function are returned to the command line. function varargout = tela_04_incerteza_tipoB_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 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) run('help_03_qualfdp') % --- Executes on button press in pushbutton6. function pushbutton6_Callback(hObject, eventdata, handles) global nb incertezaB variaveis vazios valorsel list % GIGA 6/10/9 %%% %Testes de erro if (isempty(get(handles.edit4,'String'))||isempty(get(handles.edit5,'Stri ng'))... ||isempty(get(handles.edit6,'String'))||isempty(get(handles.edit7,'Str ing'))... ||isempty(get(handles.edit8,'String'))||isempty(get(handles.edit9,'Str ing'))) errordlg('Todas as lacunas devem ser preenchidas para adicionar a incerteza tipo B!') return end if (~isempty(find(get(handles.edit4,'String') == 44, 1))||~isempty(find(get(handles.edit5,'String') == 44, 1))... ||~isempty(find(get(handles.edit6,'String') == 44, 1))) errordlg('Neste programa usa-se ponto ''.'' para separar as casas decimais! No use vrgulas '','' !') return elseif ~isanumber(get(handles.edit4,'String'))||~isanumber(get(handles.edit5, 'String'))... ||~isanumber(get(handles.edit6,'String')) errordlg('Valor da incerteza tipo B, Graus de liberdade e Coeficiente de sensibilidade precisam ser nmeros!') return end

%Testes de erro %GIGA 6/10/9 %%%

n=get(handles.popupmenu2,'Value'); if isempty(incertezaB) vazios=zeros(1,length(variaveis.nome)); vazios(n)=1; %matriz q diz se jah foi colacada incerteza do tipo B a uma variavel

nb=0; elseif vazios(n)==0 vazios(n)=1; nb=0; else eval(['nb=length(incertezaB.' cell2mat(variaveis.simbolo(n)) '.valor);']) end nb=nb+1; eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.unidade(nb)={get(handles.edit8,' '''String''' ')};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.valor(nb)=str2num(get(handles.edit4,' '''String''' '));']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.liberdade(nb)=str2num(get(handles.edit6,' '''String''' '));']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.sensibilidade(nb)=str2num(get(handles.edit5,' '''String''' '));']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.nome(nb)={get(handles.edit7,' '''String''' ')};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.unid_sensi(nb)={get(handles.edit9,' '''String''' ')};']); % eval(['incertezaB.' cell2mat(variaveis.simbolo(nb)) '.fdp(nb)={get(handles.edit4,' 'String' ')};']); % incertezaB.liberdade(nb)={get(handles.edit6,'String')}; % incertezaB.sensibilidade(nb)={get(handles.edit5,'String')}; eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.fdp(nb)={find([get(handles.radiobutton4,' '''Value''' '),get(handles.radiobutton5,' '''Value''' '),'... 'get(handles.radiobutton6,' '''Value''' ')])};']); % o valor 1 representa gaussiana, 3 triangular e 3 retangular % hObject handle to pushbutton6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) valorsel = get(handles.popupmenu2,'Value'); t=cellstr([cell2mat(eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.nome(nb)']))... ' ' num2str(eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.valor(nb)']))... ' ' cell2mat(eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.unidade(nb)']))]); eval(['list.' cell2mat(variaveis.simbolo(n)) '(nb,:)=t;']) eval(['set(handles.listbox2,' '''String''' ',list.' cell2mat(variaveis.simbolo(n)) ')']) set(handles.edit7,'string','') set(handles.edit4,'string','') set(handles.edit5,'string','') set(handles.edit6,'string','') set(handles.edit8,'string','') set(handles.edit9,'string','') set([handles.pushbutton7],'Enable','on') % --- Executes on button press in pushbutton7. function pushbutton7_Callback(hObject, eventdata, handles) global nb vazios variaveis incertezaB list if isempty(nb)==0 nb=nb-1;

end valorsel = get(handles.popupmenu2,'Value'); currentVal= get(handles.listbox2,'Value'); %este comando pega o valor que est selecionado no listbox um nmero de 1 ao nmero de variveis adcionadas resultsStr = get(handles.listbox2,'String'); %este comando pega a varivel que armazena os nomes do listbox numResults = size(resultsStr,1); %este comando clcula o nmero de variveis que temos no listbox resultsStr(currentVal) =[]; eval(['list.' cell2mat(variaveis.simbolo(valorsel)) '=resultsStr']); %transforma em vazio o local do listbox selecionado %ver qual variavel est selecionada no listbox eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.unidade(currentVal)=[];']); eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.valor(currentVal)=[];']); eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.liberdade(currentVal)=[];']); eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.sensibilidade(currentVal)=[];']); eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.nome(currentVal)=[];']); % eval(['incertezaB.' cell2mat(variaveis.simbolo(nb)) '.fdp(nb)={get(handles.edit4,' 'String' ')};']); % incertezaB.liberdade(nb)={get(handles.edit6,'String')}; % incertezaB.sensibilidade(nb)={get(handles.edit5,'String')}; eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.fdp(currentVal)=[];']); if numResults ==0 vazios(currentVal)=[]; end %DESABILITANDO O BOTO SE NO TEMOS MAIS VARIVEIS A SER REMOVIDAS %MUDA A LISTA DE STRINGS PARA VAZIO if isequal(numResults,length(currentVal)),%se for igual o nmero de variveis a 1 resultsStr = {'<empty>'};%esvazia o listbox currentVal = 1;% e faz o valor selecionado igual a 1 eval(['list.' cell2mat(variaveis.simbolo(valorsel)) '=resultsStr']); set([handles.pushbutton7],'Enable','off')%desativA o boto de remover end %----------------------------------------------------------------------%TRANSFORMA O CURRENTVAL(NMERO INTEIRO QUE CORRESPONDE A VALUE)NO MENOR %VALOR ENTRE O ANTIGO VALUE E O TAMANHO DO STRING QUE EST NO LISTBOX (NMERO DE VARIVEIS) currentVal = min(currentVal,size(resultsStr,1)); set(handles.listbox2,'Value',currentVal,'String',resultsStr) %-----------------------------------------------------% hObject handle to pushbutton7 (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 listbox2. % hObject handle to pushbutton7 (see GCBO)

% eventdata % handles

reserved - to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA)

% --- Executes on selection change in listbox2. function listbox2_Callback(hObject, eventdata, handles) % hObject handle to listbox2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns listbox2 contents as cell array % contents{get(hObject,'Value')} returns selected item from listbox2

% --- Executes during object creation, after setting all properties. function listbox2_CreateFcn(hObject, eventdata, handles) % hObject handle to listbox2 (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

% --- Executes on button press in radiobutton4. function radiobutton4_Callback(hObject, eventdata, handles) set(handles.radiobutton5, 'Value', 0) set(handles.radiobutton6, 'Value', 0) set(handles.radiobutton4, 'Value', 1) set(handles.text6,'String','Valor da incerteza do tipo B') % hObject handle to radiobutton4 (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 radiobutton4

% --- Executes on button press in radiobutton5. function radiobutton5_Callback(hObject, eventdata, handles) set(handles.radiobutton4, 'Value', 0) set(handles.radiobutton6, 'Value', 0) set(handles.radiobutton5, 'Value', 1) set(handles.text6,'String','Amplitude (Max-Min)') % hObject handle to radiobutton5 (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 radiobutton5

% --- Executes on button press in radiobutton6. function radiobutton6_Callback(hObject, eventdata, handles)

set(handles.radiobutton4, 'Value', 0) set(handles.radiobutton5, 'Value', 0) set(handles.radiobutton6, 'Value', 1) set(handles.text6,'String','Amplitude (Max-Min)') % hObject handle to radiobutton6 (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 radiobutton6

% --- Executes on selection change in popupmenu2. function popupmenu2_Callback(hObject, eventdata, handles) global vazios incertezaB variaveis list % hObject handle to popupmenu2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu2 valorsel = get(handles.popupmenu2,'Value'); if isempty(vazios)==0 if vazios(1,valorsel)~=0 set(handles.listbox2,'String',eval(['list.' cell2mat(variaveis.simbolo(valorsel))])) else set(handles.listbox2,'String','') end end resultsStr = get(handles.listbox2,'String'); %este comando pega a varivel que armazena os nomes do listbox numResults = size(resultsStr,1); %este comando clcula o nmero de variveis que temos no listbox if numResults ~=0 set([handles.pushbutton7],'Enable','on') else set([handles.pushbutton7],'Enable','off') end % hObject handle to popupmenu2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu2

% --- Executes during object creation, after setting all properties. function popupmenu2_CreateFcn(hObject, eventdata, handles) global variaveis n % hObject handle to popupmenu2 (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

set(hObject, 'String', variaveis.nome'); function edit4_Callback(hObject, eventdata, handles) % hObject handle to edit4 (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 edit4 as text % str2double(get(hObject,'String')) returns contents of edit4 as a double

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

% --- Executes during object creation, after setting all properties. function edit5_CreateFcn(hObject, eventdata, handles) % hObject handle to edit5 (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 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) run('help_coeficiente_de_sensibilidade')

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) % 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

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

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

close run('tela_03_entrada_de_dados')

% --- Executes on button press in pushbutton12. function pushbutton12_Callback(hObject, eventdata, handles)

global medicao variaveis metodo incertezaB vazios variavelsaida if isempty(incertezaB)==1 for j=1:length(variaveis.nome) eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.unidade={''''};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.valor=0;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.liberdade=1^10;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.sensibilidade=0;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.nome={''''};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.fdp={1};']); if medicao==1 vazios=0; end end else for j=1:length(variaveis.nome) if vazios(j)==0 eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.unidade={''''};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.valor=0;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.liberdade=1^10;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.sensibilidade=0;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.nome={''''};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.fdp={1};']); end end end close if medicao==0 run('tela_05_modelo') else modelo=cell2mat(variaveis.simbolo); variavelsaida.nome=variaveis.nome; variavelsaida.unidade=variaveis.unidade; variavelsaida.simbolo=variaveis.simbolo; if metodo(1)==1 run('Programa_ISO') end if metodo(2)==1 run('MMC_codigo') end if metodo(1)==1 run('tela_06_relatorio') end if metodo(2)==1 run('Grafico') end end % hObject % eventdata % handles handle to pushbutton12 (see GCBO) reserved - to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA)

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

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

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

% --- Executes during object creation, after setting all properties. function edit9_CreateFcn(hObject, eventdata, handles) % hObject handle to edit9 (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 during object creation, after setting all properties. function pushbutton6_CreateFcn(hObject, eventdata, handles) % hObject handle to pushbutton6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called Tela 05 function varargout = tela_04_incerteza_tipoB(varargin) % TELA_04_INCERTEZA_TIPOB M-file for tela_04_incerteza_tipoB.fig % TELA_04_INCERTEZA_TIPOB, by itself, creates a new TELA_04_INCERTEZA_TIPOB or raises the existing % singleton*. % % H = TELA_04_INCERTEZA_TIPOB returns the handle to a new TELA_04_INCERTEZA_TIPOB or the handle to % the existing singleton*. % % TELA_04_INCERTEZA_TIPOB('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in TELA_04_INCERTEZA_TIPOB.M with the given input arguments. % % TELA_04_INCERTEZA_TIPOB('Property','Value',...) creates a new TELA_04_INCERTEZA_TIPOB or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before tela_04_incerteza_tipoB_OpeningFunction gets called. An

% unrecognized property name or invalid value makes property application % stop. All inputs are passed to tela_04_incerteza_tipoB_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 tela_04_incerteza_tipoB % Last Modified by GUIDE v2.5 23-Sep-2009 11:03:30 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @tela_04_incerteza_tipoB_OpeningFcn, ... 'gui_OutputFcn', @tela_04_incerteza_tipoB_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 tela_04_incerteza_tipoB is made visible. function tela_04_incerteza_tipoB_OpeningFcn(hObject, eventdata, handles, varargin) global list variaveis % 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 tela_04_incerteza_tipoB (see VARARGIN) % Choose default command line output for tela_04_incerteza_tipoB handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes tela_04_incerteza_tipoB wait for user response (see UIRESUME) % uiwait(handles.figure1); if isempty(list)~=1

eval(['set(handles.listbox2,' '''String''' ',list.' cell2mat(variaveis.simbolo(1)) ')']) end

% --- Outputs from this function are returned to the command line. function varargout = tela_04_incerteza_tipoB_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 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) run('help_03_qualfdp') % --- Executes on button press in pushbutton6. function pushbutton6_Callback(hObject, eventdata, handles) global nb incertezaB variaveis vazios valorsel list % GIGA 6/10/9 %%% %Testes de erro if (isempty(get(handles.edit4,'String'))||isempty(get(handles.edit5,'Stri ng'))... ||isempty(get(handles.edit6,'String'))||isempty(get(handles.edit7,'Str ing'))... ||isempty(get(handles.edit8,'String'))||isempty(get(handles.edit9,'Str ing'))) errordlg('Todas as lacunas devem ser preenchidas para adicionar a incerteza tipo B!') return end if (~isempty(find(get(handles.edit4,'String') == 44, 1))||~isempty(find(get(handles.edit5,'String') == 44, 1))... ||~isempty(find(get(handles.edit6,'String') == 44, 1))) errordlg('Neste programa usa-se ponto ''.'' para separar as casas decimais! No use vrgulas '','' !') return elseif ~isanumber(get(handles.edit4,'String'))||~isanumber(get(handles.edit5, 'String'))... ||~isanumber(get(handles.edit6,'String')) errordlg('Valor da incerteza tipo B, Graus de liberdade e Coeficiente de sensibilidade precisam ser nmeros!') return

end

%Testes de erro %GIGA 6/10/9 %%%

n=get(handles.popupmenu2,'Value'); if isempty(incertezaB) vazios=zeros(1,length(variaveis.nome)); vazios(n)=1; %matriz q diz se jah foi colacada incerteza do tipo B a uma variavel nb=0; elseif vazios(n)==0 vazios(n)=1; nb=0; else eval(['nb=length(incertezaB.' cell2mat(variaveis.simbolo(n)) '.valor);']) end nb=nb+1; eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.unidade(nb)={get(handles.edit8,' '''String''' ')};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.valor(nb)=str2num(get(handles.edit4,' '''String''' '));']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.liberdade(nb)=str2num(get(handles.edit6,' '''String''' '));']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.sensibilidade(nb)=str2num(get(handles.edit5,' '''String''' '));']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.nome(nb)={get(handles.edit7,' '''String''' ')};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.unid_sensi(nb)={get(handles.edit9,' '''String''' ')};']); % eval(['incertezaB.' cell2mat(variaveis.simbolo(nb)) '.fdp(nb)={get(handles.edit4,' 'String' ')};']); % incertezaB.liberdade(nb)={get(handles.edit6,'String')}; % incertezaB.sensibilidade(nb)={get(handles.edit5,'String')}; eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.fdp(nb)={find([get(handles.radiobutton4,' '''Value''' '),get(handles.radiobutton5,' '''Value''' '),'... 'get(handles.radiobutton6,' '''Value''' ')])};']); % o valor 1 representa gaussiana, 3 triangular e 3 retangular % hObject handle to pushbutton6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) valorsel = get(handles.popupmenu2,'Value'); t=cellstr([cell2mat(eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.nome(nb)']))... ' ' num2str(eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.valor(nb)']))... ' ' cell2mat(eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.unidade(nb)']))]); eval(['list.' cell2mat(variaveis.simbolo(n)) '(nb,:)=t;'])

eval(['set(handles.listbox2,' '''String''' ',list.' cell2mat(variaveis.simbolo(n)) ')']) set(handles.edit7,'string','') set(handles.edit4,'string','') set(handles.edit5,'string','') set(handles.edit6,'string','') set(handles.edit8,'string','') set(handles.edit9,'string','') set([handles.pushbutton7],'Enable','on') % --- Executes on button press in pushbutton7. function pushbutton7_Callback(hObject, eventdata, handles) global nb vazios variaveis incertezaB list if isempty(nb)==0 nb=nb-1; end valorsel = get(handles.popupmenu2,'Value'); currentVal= get(handles.listbox2,'Value'); %este comando pega o valor que est selecionado no listbox um nmero de 1 ao nmero de variveis adcionadas resultsStr = get(handles.listbox2,'String'); %este comando pega a varivel que armazena os nomes do listbox numResults = size(resultsStr,1); %este comando clcula o nmero de variveis que temos no listbox resultsStr(currentVal) =[]; eval(['list.' cell2mat(variaveis.simbolo(valorsel)) '=resultsStr']); %transforma em vazio o local do listbox selecionado %ver qual variavel est selecionada no listbox eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.unidade(currentVal)=[];']); eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.valor(currentVal)=[];']); eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.liberdade(currentVal)=[];']); eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.sensibilidade(currentVal)=[];']); eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.nome(currentVal)=[];']); % eval(['incertezaB.' cell2mat(variaveis.simbolo(nb)) '.fdp(nb)={get(handles.edit4,' 'String' ')};']); % incertezaB.liberdade(nb)={get(handles.edit6,'String')}; % incertezaB.sensibilidade(nb)={get(handles.edit5,'String')}; eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.fdp(currentVal)=[];']); if numResults ==0 vazios(currentVal)=[]; end %DESABILITANDO O BOTO SE NO TEMOS MAIS VARIVEIS A SER REMOVIDAS %MUDA A LISTA DE STRINGS PARA VAZIO if isequal(numResults,length(currentVal)),%se for igual o nmero de variveis a 1 resultsStr = {'<empty>'};%esvazia o listbox currentVal = 1;% e faz o valor selecionado igual a 1 eval(['list.' cell2mat(variaveis.simbolo(valorsel)) '=resultsStr']); set([handles.pushbutton7],'Enable','off')%desativA o boto de remover end

%----------------------------------------------------------------------%TRANSFORMA O CURRENTVAL(NMERO INTEIRO QUE CORRESPONDE A VALUE)NO MENOR %VALOR ENTRE O ANTIGO VALUE E O TAMANHO DO STRING QUE EST NO LISTBOX (NMERO DE VARIVEIS) currentVal = min(currentVal,size(resultsStr,1)); set(handles.listbox2,'Value',currentVal,'String',resultsStr) %-----------------------------------------------------% hObject handle to pushbutton7 (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 listbox2. hObject handle to pushbutton7 (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 listbox2. function listbox2_Callback(hObject, eventdata, handles) % hObject handle to listbox2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns listbox2 contents as cell array % contents{get(hObject,'Value')} returns selected item from listbox2

% --- Executes during object creation, after setting all properties. function listbox2_CreateFcn(hObject, eventdata, handles) % hObject handle to listbox2 (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

% --- Executes on button press in radiobutton4. function radiobutton4_Callback(hObject, eventdata, handles) set(handles.radiobutton5, 'Value', 0) set(handles.radiobutton6, 'Value', 0) set(handles.radiobutton4, 'Value', 1) set(handles.text6,'String','Valor da incerteza do tipo B') % hObject handle to radiobutton4 (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 radiobutton4

% --- Executes on button press in radiobutton5. function radiobutton5_Callback(hObject, eventdata, handles) set(handles.radiobutton4, 'Value', 0) set(handles.radiobutton6, 'Value', 0) set(handles.radiobutton5, 'Value', 1) set(handles.text6,'String','Amplitude (Max-Min)') % hObject handle to radiobutton5 (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 radiobutton5

% --- Executes on button press in radiobutton6. function radiobutton6_Callback(hObject, eventdata, handles) set(handles.radiobutton4, 'Value', 0) set(handles.radiobutton5, 'Value', 0) set(handles.radiobutton6, 'Value', 1) set(handles.text6,'String','Amplitude (Max-Min)') % hObject handle to radiobutton6 (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 radiobutton6

% --- Executes on selection change in popupmenu2. function popupmenu2_Callback(hObject, eventdata, handles) global vazios incertezaB variaveis list % hObject handle to popupmenu2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu2 valorsel = get(handles.popupmenu2,'Value'); if isempty(vazios)==0 if vazios(1,valorsel)~=0 set(handles.listbox2,'String',eval(['list.' cell2mat(variaveis.simbolo(valorsel))])) else set(handles.listbox2,'String','') end end resultsStr = get(handles.listbox2,'String'); %este comando pega a varivel que armazena os nomes do listbox numResults = size(resultsStr,1); %este comando clcula o nmero de variveis que temos no listbox if numResults ~=0 set([handles.pushbutton7],'Enable','on') else set([handles.pushbutton7],'Enable','off') end % hObject handle to popupmenu2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu2

% --- Executes during object creation, after setting all properties. function popupmenu2_CreateFcn(hObject, eventdata, handles) global variaveis n % hObject handle to popupmenu2 (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

set(hObject, 'String', variaveis.nome'); function edit4_Callback(hObject, eventdata, handles) % hObject handle to edit4 (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 edit4 as text % str2double(get(hObject,'String')) returns contents of edit4 as a double

% --- Executes during object creation, after setting all properties. function edit4_CreateFcn(hObject, eventdata, handles) % hObject handle to edit4 (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 edit5_Callback(hObject, eventdata, handles) % hObject handle to edit5 (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 edit5 as text

% str2double(get(hObject,'String')) returns contents of edit5 as a double

% --- Executes during object creation, after setting all properties. function edit5_CreateFcn(hObject, eventdata, handles) % hObject handle to edit5 (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 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) run('help_coeficiente_de_sensibilidade')

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) % 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

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

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

close run('tela_03_entrada_de_dados')

% --- Executes on button press in pushbutton12. function pushbutton12_Callback(hObject, eventdata, handles) global medicao variaveis metodo incertezaB vazios variavelsaida if isempty(incertezaB)==1 for j=1:length(variaveis.nome) eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.unidade={''''};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.valor=0;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.liberdade=1^10;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.sensibilidade=0;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.nome={''''};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.fdp={1};']); if medicao==1 vazios=0; end end else for j=1:length(variaveis.nome) if vazios(j)==0 eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.unidade={''''};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.valor=0;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.liberdade=1^10;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.sensibilidade=0;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.nome={''''};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.fdp={1};']); end end end close if medicao==0 run('tela_05_modelo') else modelo=cell2mat(variaveis.simbolo); variavelsaida.nome=variaveis.nome; variavelsaida.unidade=variaveis.unidade; variavelsaida.simbolo=variaveis.simbolo;

if metodo(1)==1 run('Programa_ISO') end if metodo(2)==1 run('MMC_codigo') end if metodo(1)==1 run('tela_06_relatorio') end if metodo(2)==1 run('Grafico') end end % hObject % eventdata % handles handle to pushbutton12 (see GCBO) reserved - to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA)

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

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

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

% --- Executes during object creation, after setting all properties. function edit9_CreateFcn(hObject, eventdata, handles) % hObject handle to edit9 (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 during object creation, after setting all properties. function pushbutton6_CreateFcn(hObject, eventdata, handles) % hObject handle to pushbutton6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called

function varargout = tela_04_incerteza_tipoB(varargin) % TELA_04_INCERTEZA_TIPOB M-file for tela_04_incerteza_tipoB.fig % TELA_04_INCERTEZA_TIPOB, by itself, creates a new TELA_04_INCERTEZA_TIPOB or raises the existing

% singleton*. % % H = TELA_04_INCERTEZA_TIPOB returns the handle to a new TELA_04_INCERTEZA_TIPOB or the handle to % the existing singleton*. % % TELA_04_INCERTEZA_TIPOB('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in TELA_04_INCERTEZA_TIPOB.M with the given input arguments. % % TELA_04_INCERTEZA_TIPOB('Property','Value',...) creates a new TELA_04_INCERTEZA_TIPOB or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before tela_04_incerteza_tipoB_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to tela_04_incerteza_tipoB_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 tela_04_incerteza_tipoB % Last Modified by GUIDE v2.5 23-Sep-2009 11:03:30 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @tela_04_incerteza_tipoB_OpeningFcn, ... 'gui_OutputFcn', @tela_04_incerteza_tipoB_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 tela_04_incerteza_tipoB is made visible. function tela_04_incerteza_tipoB_OpeningFcn(hObject, eventdata, handles, varargin) global list variaveis

% 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 tela_04_incerteza_tipoB (see VARARGIN) % Choose default command line output for tela_04_incerteza_tipoB handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes tela_04_incerteza_tipoB wait for user response (see UIRESUME) % uiwait(handles.figure1); if isempty(list)~=1 eval(['set(handles.listbox2,' '''String''' ',list.' cell2mat(variaveis.simbolo(1)) ')']) end

% --- Outputs from this function are returned to the command line. function varargout = tela_04_incerteza_tipoB_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 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) run('help_03_qualfdp') % --- Executes on button press in pushbutton6. function pushbutton6_Callback(hObject, eventdata, handles) global nb incertezaB variaveis vazios valorsel list % GIGA 6/10/9 %%% %Testes de erro if (isempty(get(handles.edit4,'String'))||isempty(get(handles.edit5,'Stri ng'))... ||isempty(get(handles.edit6,'String'))||isempty(get(handles.edit7,'Str ing'))... ||isempty(get(handles.edit8,'String'))||isempty(get(handles.edit9,'Str ing'))) errordlg('Todas as lacunas devem ser preenchidas para adicionar a incerteza tipo B!')

return end if (~isempty(find(get(handles.edit4,'String') == 44, 1))||~isempty(find(get(handles.edit5,'String') == 44, 1))... ||~isempty(find(get(handles.edit6,'String') == 44, 1))) errordlg('Neste programa usa-se ponto ''.'' para separar as casas decimais! No use vrgulas '','' !') return elseif ~isanumber(get(handles.edit4,'String'))||~isanumber(get(handles.edit5, 'String'))... ||~isanumber(get(handles.edit6,'String')) errordlg('Valor da incerteza tipo B, Graus de liberdade e Coeficiente de sensibilidade precisam ser nmeros!') return end

%Testes de erro %GIGA 6/10/9 %%%

n=get(handles.popupmenu2,'Value'); if isempty(incertezaB) vazios=zeros(1,length(variaveis.nome)); vazios(n)=1; %matriz q diz se jah foi colacada incerteza do tipo B a uma variavel nb=0; elseif vazios(n)==0 vazios(n)=1; nb=0; else eval(['nb=length(incertezaB.' cell2mat(variaveis.simbolo(n)) '.valor);']) end nb=nb+1; eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.unidade(nb)={get(handles.edit8,' '''String''' ')};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.valor(nb)=str2num(get(handles.edit4,' '''String''' '));']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.liberdade(nb)=str2num(get(handles.edit6,' '''String''' '));']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.sensibilidade(nb)=str2num(get(handles.edit5,' '''String''' '));']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.nome(nb)={get(handles.edit7,' '''String''' ')};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.unid_sensi(nb)={get(handles.edit9,' '''String''' ')};']); % eval(['incertezaB.' cell2mat(variaveis.simbolo(nb)) '.fdp(nb)={get(handles.edit4,' 'String' ')};']); % incertezaB.liberdade(nb)={get(handles.edit6,'String')}; % incertezaB.sensibilidade(nb)={get(handles.edit5,'String')};

eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.fdp(nb)={find([get(handles.radiobutton4,' '''Value''' '),get(handles.radiobutton5,' '''Value''' '),'... 'get(handles.radiobutton6,' '''Value''' ')])};']); % o valor 1 representa gaussiana, 3 triangular e 3 retangular % hObject handle to pushbutton6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) valorsel = get(handles.popupmenu2,'Value'); t=cellstr([cell2mat(eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.nome(nb)']))... ' ' num2str(eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.valor(nb)']))... ' ' cell2mat(eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.unidade(nb)']))]); eval(['list.' cell2mat(variaveis.simbolo(n)) '(nb,:)=t;']) eval(['set(handles.listbox2,' '''String''' ',list.' cell2mat(variaveis.simbolo(n)) ')']) set(handles.edit7,'string','') set(handles.edit4,'string','') set(handles.edit5,'string','') set(handles.edit6,'string','') set(handles.edit8,'string','') set(handles.edit9,'string','') set([handles.pushbutton7],'Enable','on') % --- Executes on button press in pushbutton7. function pushbutton7_Callback(hObject, eventdata, handles) global nb vazios variaveis incertezaB list if isempty(nb)==0 nb=nb-1; end valorsel = get(handles.popupmenu2,'Value'); currentVal= get(handles.listbox2,'Value'); %este comando pega o valor que est selecionado no listbox um nmero de 1 ao nmero de variveis adcionadas resultsStr = get(handles.listbox2,'String'); %este comando pega a varivel que armazena os nomes do listbox numResults = size(resultsStr,1); %este comando clcula o nmero de variveis que temos no listbox resultsStr(currentVal) =[]; eval(['list.' cell2mat(variaveis.simbolo(valorsel)) '=resultsStr']); %transforma em vazio o local do listbox selecionado %ver qual variavel est selecionada no listbox eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.unidade(currentVal)=[];']); eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.valor(currentVal)=[];']); eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.liberdade(currentVal)=[];']); eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.sensibilidade(currentVal)=[];']); eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.nome(currentVal)=[];']); % eval(['incertezaB.' cell2mat(variaveis.simbolo(nb)) '.fdp(nb)={get(handles.edit4,' 'String' ')};']);

% incertezaB.liberdade(nb)={get(handles.edit6,'String')}; % incertezaB.sensibilidade(nb)={get(handles.edit5,'String')}; eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.fdp(currentVal)=[];']); if numResults ==0 vazios(currentVal)=[]; end %DESABILITANDO O BOTO SE NO TEMOS MAIS VARIVEIS A SER REMOVIDAS %MUDA A LISTA DE STRINGS PARA VAZIO if isequal(numResults,length(currentVal)),%se for igual o nmero de variveis a 1 resultsStr = {'<empty>'};%esvazia o listbox currentVal = 1;% e faz o valor selecionado igual a 1 eval(['list.' cell2mat(variaveis.simbolo(valorsel)) '=resultsStr']); set([handles.pushbutton7],'Enable','off')%desativA o boto de remover end %----------------------------------------------------------------------%TRANSFORMA O CURRENTVAL(NMERO INTEIRO QUE CORRESPONDE A VALUE)NO MENOR %VALOR ENTRE O ANTIGO VALUE E O TAMANHO DO STRING QUE EST NO LISTBOX (NMERO DE VARIVEIS) currentVal = min(currentVal,size(resultsStr,1)); set(handles.listbox2,'Value',currentVal,'String',resultsStr) %-----------------------------------------------------% hObject handle to pushbutton7 (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 listbox2. hObject handle to pushbutton7 (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 listbox2. function listbox2_Callback(hObject, eventdata, handles) % hObject handle to listbox2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns listbox2 contents as cell array % contents{get(hObject,'Value')} returns selected item from listbox2

% --- Executes during object creation, after setting all properties. function listbox2_CreateFcn(hObject, eventdata, handles) % hObject handle to listbox2 (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

% --- Executes on button press in radiobutton4. function radiobutton4_Callback(hObject, eventdata, handles) set(handles.radiobutton5, 'Value', 0) set(handles.radiobutton6, 'Value', 0) set(handles.radiobutton4, 'Value', 1) set(handles.text6,'String','Valor da incerteza do tipo B') % hObject handle to radiobutton4 (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 radiobutton4

% --- Executes on button press in radiobutton5. function radiobutton5_Callback(hObject, eventdata, handles) set(handles.radiobutton4, 'Value', 0) set(handles.radiobutton6, 'Value', 0) set(handles.radiobutton5, 'Value', 1) set(handles.text6,'String','Amplitude (Max-Min)') % hObject handle to radiobutton5 (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 radiobutton5

% --- Executes on button press in radiobutton6. function radiobutton6_Callback(hObject, eventdata, handles) set(handles.radiobutton4, 'Value', 0) set(handles.radiobutton5, 'Value', 0) set(handles.radiobutton6, 'Value', 1) set(handles.text6,'String','Amplitude (Max-Min)') % hObject handle to radiobutton6 (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 radiobutton6

% --- Executes on selection change in popupmenu2. function popupmenu2_Callback(hObject, eventdata, handles) global vazios incertezaB variaveis list % hObject handle to popupmenu2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu2 valorsel = get(handles.popupmenu2,'Value'); if isempty(vazios)==0 if vazios(1,valorsel)~=0

set(handles.listbox2,'String',eval(['list.' cell2mat(variaveis.simbolo(valorsel))])) else set(handles.listbox2,'String','') end end resultsStr = get(handles.listbox2,'String'); %este comando pega a varivel que armazena os nomes do listbox numResults = size(resultsStr,1); %este comando clcula o nmero de variveis que temos no listbox if numResults ~=0 set([handles.pushbutton7],'Enable','on') else set([handles.pushbutton7],'Enable','off') end % hObject handle to popupmenu2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu2

% --- Executes during object creation, after setting all properties. function popupmenu2_CreateFcn(hObject, eventdata, handles) global variaveis n % hObject handle to popupmenu2 (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

set(hObject, 'String', variaveis.nome'); function edit4_Callback(hObject, eventdata, handles) % hObject handle to edit4 (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 edit4 as text % str2double(get(hObject,'String')) returns contents of edit4 as a double

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

% --- Executes during object creation, after setting all properties. function edit5_CreateFcn(hObject, eventdata, handles) % hObject handle to edit5 (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 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) run('help_coeficiente_de_sensibilidade')

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) % 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 called

empty - handles not created until after all CreateFcns

% 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 pushbutton9. function pushbutton9_Callback(hObject, eventdata, handles) % hObject handle to pushbutton9 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) run('help_04_grau')

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

close run('tela_03_entrada_de_dados')

% --- Executes on button press in pushbutton12. function pushbutton12_Callback(hObject, eventdata, handles) global medicao variaveis metodo incertezaB vazios variavelsaida if isempty(incertezaB)==1 for j=1:length(variaveis.nome) eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.unidade={''''};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.valor=0;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.liberdade=1^10;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.sensibilidade=0;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.nome={''''};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.fdp={1};']); if medicao==1 vazios=0; end end else for j=1:length(variaveis.nome) if vazios(j)==0 eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.unidade={''''};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.valor=0;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.liberdade=1^10;']);

eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.sensibilidade=0;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.nome={''''};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.fdp={1};']); end end end close if medicao==0 run('tela_05_modelo') else modelo=cell2mat(variaveis.simbolo); variavelsaida.nome=variaveis.nome; variavelsaida.unidade=variaveis.unidade; variavelsaida.simbolo=variaveis.simbolo; if metodo(1)==1 run('Programa_ISO') end if metodo(2)==1 run('MMC_codigo') end if metodo(1)==1 run('tela_06_relatorio') end if metodo(2)==1 run('Grafico') end end % hObject % eventdata % handles handle to pushbutton12 (see GCBO) reserved - to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA)

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

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

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

% --- Executes during object creation, after setting all properties. function edit9_CreateFcn(hObject, eventdata, handles) % hObject handle to edit9 (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 during object creation, after setting all properties. function pushbutton6_CreateFcn(hObject, eventdata, handles) % hObject handle to pushbutton6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called

function varargout = tela_04_incerteza_tipoB(varargin) % TELA_04_INCERTEZA_TIPOB M-file for tela_04_incerteza_tipoB.fig % TELA_04_INCERTEZA_TIPOB, by itself, creates a new TELA_04_INCERTEZA_TIPOB or raises the existing % singleton*. % % H = TELA_04_INCERTEZA_TIPOB returns the handle to a new TELA_04_INCERTEZA_TIPOB or the handle to % the existing singleton*. % % TELA_04_INCERTEZA_TIPOB('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in TELA_04_INCERTEZA_TIPOB.M with the given input arguments. % % TELA_04_INCERTEZA_TIPOB('Property','Value',...) creates a new TELA_04_INCERTEZA_TIPOB or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before tela_04_incerteza_tipoB_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to tela_04_incerteza_tipoB_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 tela_04_incerteza_tipoB % Last Modified by GUIDE v2.5 23-Sep-2009 11:03:30 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @tela_04_incerteza_tipoB_OpeningFcn, ... 'gui_OutputFcn', @tela_04_incerteza_tipoB_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 tela_04_incerteza_tipoB is made visible. function tela_04_incerteza_tipoB_OpeningFcn(hObject, eventdata, handles, varargin) global list variaveis % 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 tela_04_incerteza_tipoB (see VARARGIN) % Choose default command line output for tela_04_incerteza_tipoB handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes tela_04_incerteza_tipoB wait for user response (see UIRESUME) % uiwait(handles.figure1); if isempty(list)~=1 eval(['set(handles.listbox2,' '''String''' ',list.' cell2mat(variaveis.simbolo(1)) ')']) end

% --- Outputs from this function are returned to the command line. function varargout = tela_04_incerteza_tipoB_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 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) run('help_03_qualfdp') % --- Executes on button press in pushbutton6.

function pushbutton6_Callback(hObject, eventdata, handles) global nb incertezaB variaveis vazios valorsel list % GIGA 6/10/9 %%% %Testes de erro if (isempty(get(handles.edit4,'String'))||isempty(get(handles.edit5,'Stri ng'))... ||isempty(get(handles.edit6,'String'))||isempty(get(handles.edit7,'Str ing'))... ||isempty(get(handles.edit8,'String'))||isempty(get(handles.edit9,'Str ing'))) errordlg('Todas as lacunas devem ser preenchidas para adicionar a incerteza tipo B!') return end if (~isempty(find(get(handles.edit4,'String') == 44, 1))||~isempty(find(get(handles.edit5,'String') == 44, 1))... ||~isempty(find(get(handles.edit6,'String') == 44, 1))) errordlg('Neste programa usa-se ponto ''.'' para separar as casas decimais! No use vrgulas '','' !') return elseif ~isanumber(get(handles.edit4,'String'))||~isanumber(get(handles.edit5, 'String'))... ||~isanumber(get(handles.edit6,'String')) errordlg('Valor da incerteza tipo B, Graus de liberdade e Coeficiente de sensibilidade precisam ser nmeros!') return end

%Testes de erro %GIGA 6/10/9 %%%

n=get(handles.popupmenu2,'Value'); if isempty(incertezaB) vazios=zeros(1,length(variaveis.nome)); vazios(n)=1; %matriz q diz se jah foi colacada incerteza do tipo B a uma variavel nb=0; elseif vazios(n)==0 vazios(n)=1; nb=0; else eval(['nb=length(incertezaB.' cell2mat(variaveis.simbolo(n)) '.valor);']) end nb=nb+1;

eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.unidade(nb)={get(handles.edit8,' '''String''' ')};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.valor(nb)=str2num(get(handles.edit4,' '''String''' '));']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.liberdade(nb)=str2num(get(handles.edit6,' '''String''' '));']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.sensibilidade(nb)=str2num(get(handles.edit5,' '''String''' '));']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.nome(nb)={get(handles.edit7,' '''String''' ')};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.unid_sensi(nb)={get(handles.edit9,' '''String''' ')};']); % eval(['incertezaB.' cell2mat(variaveis.simbolo(nb)) '.fdp(nb)={get(handles.edit4,' 'String' ')};']); % incertezaB.liberdade(nb)={get(handles.edit6,'String')}; % incertezaB.sensibilidade(nb)={get(handles.edit5,'String')}; eval(['incertezaB.' cell2mat(variaveis.simbolo(n)) '.fdp(nb)={find([get(handles.radiobutton4,' '''Value''' '),get(handles.radiobutton5,' '''Value''' '),'... 'get(handles.radiobutton6,' '''Value''' ')])};']); % o valor 1 representa gaussiana, 3 triangular e 3 retangular % hObject handle to pushbutton6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) valorsel = get(handles.popupmenu2,'Value'); t=cellstr([cell2mat(eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.nome(nb)']))... ' ' num2str(eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.valor(nb)']))... ' ' cell2mat(eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.unidade(nb)']))]); eval(['list.' cell2mat(variaveis.simbolo(n)) '(nb,:)=t;']) eval(['set(handles.listbox2,' '''String''' ',list.' cell2mat(variaveis.simbolo(n)) ')']) set(handles.edit7,'string','') set(handles.edit4,'string','') set(handles.edit5,'string','') set(handles.edit6,'string','') set(handles.edit8,'string','') set(handles.edit9,'string','') set([handles.pushbutton7],'Enable','on') % --- Executes on button press in pushbutton7. function pushbutton7_Callback(hObject, eventdata, handles) global nb vazios variaveis incertezaB list if isempty(nb)==0 nb=nb-1; end valorsel = get(handles.popupmenu2,'Value'); currentVal= get(handles.listbox2,'Value'); %este comando pega o valor que est selecionado no listbox um nmero de 1 ao nmero de variveis adcionadas resultsStr = get(handles.listbox2,'String'); %este comando pega a varivel que armazena os nomes do listbox numResults = size(resultsStr,1); %este comando clcula o nmero de variveis que temos no listbox resultsStr(currentVal) =[]; eval(['list.' cell2mat(variaveis.simbolo(valorsel)) '=resultsStr']);

%transforma em vazio o local do listbox selecionado %ver qual variavel est selecionada no listbox eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.unidade(currentVal)=[];']); eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.valor(currentVal)=[];']); eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.liberdade(currentVal)=[];']); eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.sensibilidade(currentVal)=[];']); eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.nome(currentVal)=[];']); % eval(['incertezaB.' cell2mat(variaveis.simbolo(nb)) '.fdp(nb)={get(handles.edit4,' 'String' ')};']); % incertezaB.liberdade(nb)={get(handles.edit6,'String')}; % incertezaB.sensibilidade(nb)={get(handles.edit5,'String')}; eval(['incertezaB.' cell2mat(variaveis.simbolo(valorsel)) '.fdp(currentVal)=[];']); if numResults ==0 vazios(currentVal)=[]; end %DESABILITANDO O BOTO SE NO TEMOS MAIS VARIVEIS A SER REMOVIDAS %MUDA A LISTA DE STRINGS PARA VAZIO if isequal(numResults,length(currentVal)),%se for igual o nmero de variveis a 1 resultsStr = {'<empty>'};%esvazia o listbox currentVal = 1;% e faz o valor selecionado igual a 1 eval(['list.' cell2mat(variaveis.simbolo(valorsel)) '=resultsStr']); set([handles.pushbutton7],'Enable','off')%desativA o boto de remover end %----------------------------------------------------------------------%TRANSFORMA O CURRENTVAL(NMERO INTEIRO QUE CORRESPONDE A VALUE)NO MENOR %VALOR ENTRE O ANTIGO VALUE E O TAMANHO DO STRING QUE EST NO LISTBOX (NMERO DE VARIVEIS) currentVal = min(currentVal,size(resultsStr,1)); set(handles.listbox2,'Value',currentVal,'String',resultsStr) %-----------------------------------------------------% hObject handle to pushbutton7 (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 listbox2. hObject handle to pushbutton7 (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 listbox2. function listbox2_Callback(hObject, eventdata, handles) % hObject handle to listbox2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns listbox2 contents as cell array % contents{get(hObject,'Value')} returns selected item from listbox2

% --- Executes during object creation, after setting all properties. function listbox2_CreateFcn(hObject, eventdata, handles) % hObject handle to listbox2 (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

% --- Executes on button press in radiobutton4. function radiobutton4_Callback(hObject, eventdata, handles) set(handles.radiobutton5, 'Value', 0) set(handles.radiobutton6, 'Value', 0) set(handles.radiobutton4, 'Value', 1) set(handles.text6,'String','Valor da incerteza do tipo B') % hObject handle to radiobutton4 (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 radiobutton4

% --- Executes on button press in radiobutton5. function radiobutton5_Callback(hObject, eventdata, handles) set(handles.radiobutton4, 'Value', 0) set(handles.radiobutton6, 'Value', 0) set(handles.radiobutton5, 'Value', 1) set(handles.text6,'String','Amplitude (Max-Min)') % hObject handle to radiobutton5 (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 radiobutton5

% --- Executes on button press in radiobutton6. function radiobutton6_Callback(hObject, eventdata, handles) set(handles.radiobutton4, 'Value', 0) set(handles.radiobutton5, 'Value', 0) set(handles.radiobutton6, 'Value', 1) set(handles.text6,'String','Amplitude (Max-Min)') % hObject handle to radiobutton6 (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 radiobutton6

% --- Executes on selection change in popupmenu2. function popupmenu2_Callback(hObject, eventdata, handles) global vazios incertezaB variaveis list % hObject handle to popupmenu2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu2 valorsel = get(handles.popupmenu2,'Value'); if isempty(vazios)==0 if vazios(1,valorsel)~=0 set(handles.listbox2,'String',eval(['list.' cell2mat(variaveis.simbolo(valorsel))])) else set(handles.listbox2,'String','') end end resultsStr = get(handles.listbox2,'String'); %este comando pega a varivel que armazena os nomes do listbox numResults = size(resultsStr,1); %este comando clcula o nmero de variveis que temos no listbox if numResults ~=0 set([handles.pushbutton7],'Enable','on') else set([handles.pushbutton7],'Enable','off') end % hObject handle to popupmenu2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array % contents{get(hObject,'Value')} returns selected item from popupmenu2

% --- Executes during object creation, after setting all properties. function popupmenu2_CreateFcn(hObject, eventdata, handles) global variaveis n % hObject handle to popupmenu2 (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

set(hObject, 'String', variaveis.nome'); function edit4_Callback(hObject, eventdata, handles) % hObject handle to edit4 (see GCBO)

% eventdata % handles

reserved - to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit4 as text % str2double(get(hObject,'String')) returns contents of edit4 as a double

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

% --- Executes during object creation, after setting all properties. function edit5_CreateFcn(hObject, eventdata, handles) % hObject handle to edit5 (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 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) run('help_coeficiente_de_sensibilidade')

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) % 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

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

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

close run('tela_03_entrada_de_dados')

% --- Executes on button press in pushbutton12. function pushbutton12_Callback(hObject, eventdata, handles) global medicao variaveis metodo incertezaB vazios variavelsaida if isempty(incertezaB)==1 for j=1:length(variaveis.nome) eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.unidade={''''};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.valor=0;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.liberdade=1^10;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.sensibilidade=0;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.nome={''''};']);

eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.fdp={1};']); if medicao==1 vazios=0; end end else for j=1:length(variaveis.nome) if vazios(j)==0 eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.unidade={''''};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.valor=0;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.liberdade=1^10;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.sensibilidade=0;']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.nome={''''};']); eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.fdp={1};']); end end end close if medicao==0 run('tela_05_modelo') else modelo=cell2mat(variaveis.simbolo); variavelsaida.nome=variaveis.nome; variavelsaida.unidade=variaveis.unidade; variavelsaida.simbolo=variaveis.simbolo; if metodo(1)==1 run('Programa_ISO') end if metodo(2)==1 run('MMC_codigo') end if metodo(1)==1 run('tela_06_relatorio') end if metodo(2)==1 run('Grafico') end end % hObject % eventdata % handles handle to pushbutton12 (see GCBO) reserved - to be defined in a future version of MATLAB structure with handles and user data (see GUIDATA)

function edit7_Callback(hObject, eventdata, handles) % hObject handle to edit7 (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 edit7 as text

% str2double(get(hObject,'String')) returns contents of edit7 as a double

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

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

% --- Executes during object creation, after setting all properties. function edit9_CreateFcn(hObject, eventdata, handles) % hObject handle to edit9 (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 during object creation, after setting all properties. function pushbutton6_CreateFcn(hObject, eventdata, handles) % hObject handle to pushbutton6 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called Subrotina 1 function y=trirnd(a,b,tamanho) % X = TRIRND(A,B,TAMANHO) Gera uma amostra que obedece a uma funo % densidade probabilidade triangular no intervalo entre A e B, com tamanho % igual a TAMANHO e moda igual a mdia de A e B. t=[a,b]; media=(a+b)/2; x=rand(1,tamanho); pico=(media-min(t))/(max(t)-min(t)); y=zeros(1,tamanho); B=max(t); A=min(t); y(x>pico)=B-sqrt((B-media)*(B-A)*(1-x(x>pico))); y(x<=pico)=A+sqrt((media-A)*(B-A)*x(x<=pico)); Codigo programa Monte Carlo global nc variaveis incertezaB modelo vazios saida intervalo %valores=media %limite_i=variaveis.desvio; para uniforme e triangular %limite_s=variaveis.media; para uniforme e triangular n=length(variaveis.nome); %quantidade de variaveis fdp=zeros(10^6,n); x_quenusa=1;%loading bar stopBar= progressbar(x_quenusa/10); if (stopBar) break; end

if isempty(incertezaB)

for cnt4=1:n raizn=sqrt(variaveis.medidas(cnt4)); if variaveis.fdp==1 fdp(:,cnt4)=normrnd(str2double(cell2mat(variaveis.media(cnt4))),str2do uble(cell2mat(variaveis.desvio(cnt4)))*raizn,10^6,1); elseif variaveis.fdp==3 fdp(:,cnt4)=unifrnd(str2double(cell2mat(variaveis.media(cnt4))),str2do uble(cell2mat(variaveis.desvio(cnt4))),[1,10^6])'; else fdp(:,cnt4)=trirnd(str2double(cell2mat(variaveis.media(cnt4))),str2dou ble(cell2mat(variaveis.desvio(cnt4))),10^6); end end else for cnt4=1:n if cell2mat(variaveis.fdp(cnt4))==1 fdp(:,cnt4)=normrnd(str2double(cell2mat(variaveis.media(cnt4))),str2do uble(cell2mat(variaveis.desvio(cnt4))),10^6,1); % Variavel simulada por MMC B=0; if vazios(cnt4)==1 eval(['z=length(incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.valor);']) %quantidade de incertezas tipo B associadas eval(['fdpB=incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.fdp;']) eval(['sensiB=incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.sensibilidade;']) B=zeros(10^6,z); for j_que_nao_usa=1:z if cell2mat(fdpB(j_que_nao_usa))==1 eval(['B(:,j_que_nao_usa)=sensiB(j_que_nao_usa)*normrnd(0,incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.valor(j_que_nao_usa),10^6,1);']) elseif cell2mat(fdpB(j_que_nao_usa))==3 eval(['a=incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.valor(j_que_nao_usa);']) B(:,j_que_nao_usa)=sensiB(j_que_nao_usa)*unifrnd(a*sqrt(3),a*sqrt(3),[10^6,1]); else eval(['a=incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.valor(j_que_nao_usa);']) B(:,j_que_nao_usa)=sensiB(j_que_nao_usa)*trirnd(a*sqrt(6),a*sqrt(6),10^6); end end fdp(:,cnt4)=fdp(:,cnt4)+sum(B,2); end elseif cell2mat(variaveis.fdp(cnt4))==3 fdp(:,cnt4)=unifrnd(str2double(cell2mat(variaveis.desvio(cnt4))),str2d ouble(cell2mat(variaveis.media(cnt4))),[1,10^6])'; B=0; if vazios(cnt4)==1 eval(['z=length(incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.valor);'])

eval(['fdpB=incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.fdp;']) eval(['sensiB=incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.sensibilidade;']) B=zeros(10^6,z); for j_que_nao_usa=1:z if cell2mat(fdpB(j_que_nao_usa))==1 eval(['B(:,j_que_nao_usa)=sensiB(j_que_nao_usa)*normrnd(0,incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.valor(j_que_nao_usa),10^6,1);']) elseif cell2mat(fdpB(j_que_nao_usa))==3 eval(['a=incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.valor(j_que_nao_usa);']) B(:,j_que_nao_usa)=sensiB(j_que_nao_usa)*unifrnd(a*sqrt(3),a*sqrt(3),[10^6,1]); else eval(['a=incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.valor(j_que_nao_usa);']) B(:,j_que_nao_usa)=sensiB(j_que_nao_usa)*trirnd(a*sqrt(6),a*sqrt(6),10^6); end end end fdp(:,cnt4)=fdp(:,cnt4)+sum(B,2); x_quenusa=2;%loading bar stopBar= progressbar(x_quenusa/10); if (stopBar) break; end else fdp(:,cnt4)=trirnd(str2double(cell2mat(variaveis.desvio(cnt4))),str2do uble(cell2mat(variaveis.media(cnt4))),10^6); B=0; if vazios(cnt4)==1 eval(['z=length(incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.valor);']) eval(['fdpB=incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.fdp;']) eval(['sensiB=incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.sensibilidade;']) B=zeros(10^6,z); for j_que_nao_usa=1:z if cell2mat(fdpB(j_que_nao_usa))==1 eval(['B(:,j_que_nao_usa)=sensiB(j_que_nao_usa)*normrnd(0,str2double(c ell2mat(incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.valor(j_que_nao_usa),10^6,1);']) elseif cell2mat(fdpB(j_que_nao_usa))==3 eval(['a=incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.valor(j_que_nao_usa);']) B(:,j_que_nao_usa)=sensiB(j_que_nao_usa)*unifrnd(a,a,[10^6,1]); else eval(['a=incertezaB.' cell2mat(variaveis.simbolo(cnt4)) '.valor(j_que_nao_usa);']) B(:,j_que_nao_usa)=sensiB(j_que_nao_usa)*trirnd(a,a,10^6); end end fdp(:,cnt4)=fdp(:,cnt4)+sum(B,2);

end end end end x_quenusa=3;%loading bar stopBar= progressbar(x_quenusa/10); if (stopBar) break; end

for cnt5=1:n eval([cell2mat(variaveis.simbolo(cnt5)) '=fdp(:,cnt5);']); x_quenusa=x_quenusa+1;%loading bar stopBar= progressbar(x_quenusa/10); if (stopBar) break; end

end x_quenusa=7;%loading bar stopBar= progressbar(x_quenusa/10); if (stopBar) break; end

modelon=double(modelo); multiplicacao=find(modelon==42); divisao=find(modelon==47); exponencial=find(modelon==94); z=length(modelo)+length(divisao)+length(multiplicacao)+length(exponenc ial); j_que_nao_usa=1; t_que_nao_usa=1;

x_quenusa=8;%loading bar stopBar= progressbar(x_quenusa/10); if (stopBar) break; end

while j_que_nao_usa<=z n=0; if modelon(t_que_nao_usa)==42 modeloponto(j_que_nao_usa)='.'; modeloponto(j_que_nao_usa+1)='*'; n=1; elseif modelon(t_que_nao_usa)==47 modeloponto(j_que_nao_usa)='.'; modeloponto(j_que_nao_usa+1)='/'; n=1; elseif modelon(t_que_nao_usa)==94 modeloponto(j_que_nao_usa)='.'; modeloponto(j_que_nao_usa+1)='^'; n=1; else modeloponto(j_que_nao_usa)=modelo(t_que_nao_usa); end if n==1 j_que_nao_usa=j_que_nao_usa+1; end

j_que_nao_usa=j_que_nao_usa+1; t_que_nao_usa=t_que_nao_usa+1; end

% [ycdf xcdf]=cdfcalc(saida); %calcula os pontos da cdf % cdfinversa=spline(ycdf(2:end),xcdf); %calcula a funcao cdf % limalpha=1-str2num(nc)/100; %calcula o limite de alpha % pontos=linspace(0,limalpha,500000); % alpha % f=ppval(cdfinversa,pontos+str2num(nc)/100)-ppval(cdfinversa,pontos); % funcao com intervalos em que a area c % menoralpha=pontos(find(f==min(f))); % alpha que possui menor intervalo % superior=1-menoralpha; % intervalo=ppval(cdfinversa,[menoralpha superior]); %intervalo saida=eval(modeloponto); varorden=sort(saida); r=1:length(saida); p=(r-0.5)/length(saida); xg=linspace(0,1-str2num(nc)/100,5000); funcao=interp1(p,varorden,xg+str2num(nc)/100)-interp1(p,varorden,xg); local=find(funcao==min(funcao)); minimo=xg(local); limitesuperior=interp1(p,varorden,minimo+str2num(nc)/100); limiteinferior=interp1(p,varorden,(minimo)); intervalo=[limiteinferior limitesuperior]; x_quenusa=10;%loading bar stopBar= progressbar(x_quenusa/10); if (stopBar) break; end close save GEU_MMC Cdigo ISOGUM global incertezaB variaveis variavelsaida modelo nc incertezapadrao ... incertezaexpandida k veff coefsvalor veffvariaveis incertezaexpandidas ... significativo incertezapadraos %valores=media %limite_i=variaveis.desvio; para uniforme e triangular %limite_s=variaveis.media; para uniforme e triangular n=length(variaveis.nome); for j= 1:n %transformacao em simbolicos e numeros % simbolicos(j)=sym(cell2mat(variaveis.simbolo(j))); media(j)=str2num(cell2mat(variaveis.media(j))); % linha=1 medidas(j)=str2num(cell2mat(variaveis.medidas(j))); % linha=2 desvios(j)=str2num(cell2mat(variaveis.desvio(j))); % linha=3 eval(['o=length(incertezaB.' cell2mat(variaveis.simbolo(j)) '.valor);']); % linha=4 z(j)=desvios(j);

% linha=5 if cell2mat(variaveis.fdp(j))==3 %Para varivel de entrada desvios(j)=(media(j)-desvios(j))/(2*sqrt(3)); % linha=6 media(j)=(media(j)-desvios(j))/2; % linha=7 elseif cell2mat(variaveis.fdp(j))==2 desvios(j)=(media(j)-desvios(j))/(2*sqrt(6)); % linha=8 media(j)=(media(j)-desvios(j))/2; % linha=9 end for i=1:o %Para incerteza B da varivel de entrada eval(['incertezaBm(1,i)=incertezaB.' cell2mat(variaveis.simbolo(j)) '.valor(1,i);']); %incerteza Bm variavel do tipo matriz % linha=10 eval(['liberdade(1,i)=incertezaB.' cell2mat(variaveis.simbolo(j)) '.liberdade(1,i);']); % linha=11 eval(['sensibilidade(1,i)=incertezaB.' cell2mat(variaveis.simbolo(j)) '.sensibilidade(1,i);']); % linha=11; eval(['fdp(1,i)=incertezaB.' cell2mat(variaveis.simbolo(j)) '.fdp(1,i);']); % linha=12 if cell2mat(fdp(1,i))==3 a=eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.valor(1,i);']); % linha=13 eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.valor(1,i)=a/(2*sqrt(3));']) % linha=14 elseif cell2mat(fdp(1,i))==2 a=eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.valor(1,i);']); % linha=15 eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.valor(1,i)=a/(2*sqrt(6));']); % linha=16 end eval(['incertezaBm(1,i)=incertezaB.' cell2mat(variaveis.simbolo(j)) '.valor(1,i);']); %incerteza Bm variavel do tipo matriz % linha=17 incertezaBc(1,j)={incertezaBm}; %incerteza Bc variavel do tipo cell % linha=18 incertezaBc(2,j)={liberdade}; incertezaBc(3,j)={sensibilidade}; incertezaBc(4,j)={fdp}; end end for j=1:n %coeficientes de sensibilidade % variaveis.coef(j)=diff(modelo,simbolicos(j)); % coefsvalor(j)=(subs(variaveis.coef(j),simbolicos,media))^2; coefsvalor(j)=der(j,variaveis.simbolo,media,modelo)^2; end for j=1:n

variaveis.incerteza(j)=desvios(j)^2+sum(eval(['incertezaB.' cell2mat(variaveis.simbolo(j)) '.valor.*cell2mat(incertezaBc(3,j))']).^2); end incertezapadrao=sum(coefsvalor.*variaveis.incerteza); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%graus de liberdade%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for j=1:n veffvariaveis(j)=variaveis.incerteza(j)^2/((desvios(j)^4/(medidas(j)1))+sum(((cell2mat(incertezaBc(3,j)).*cell2mat(incertezaBc(1,j))).^4). /liberdade)); end veff=floor(incertezapadrao^2/sum((coefsvalor.*variaveis.incerteza).^2. /veffvariaveis)); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%t de student%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% veff=eval('veff'); if isa(veff,'sym') veff=eval(veff); end k=-tinv((1-str2num(nc)/100)/2,veff); incertezaexpandida=sqrt(incertezapadrao)*k; incertezaexpandida=eval('incertezaexpandida'); if isa(incertezaexpandida,'sym') incertezaexpandida=eval(incertezaexpandida); end incertezapadrao=sqrt(incertezapadrao); if isa(incertezapadrao,'sym') incertezapadrao=eval(incertezapadrao); end desvios=z; if significativo==1 incertezapadraos=sprintf('%3.1e',incertezapadrao); incertezaexpandidas=sprintf('%3.1e',incertezaexpandida); else incertezapadraos=sprintf('%3.0e',incertezapadrao); incertezaexpandidas=sprintf('%3.0e',incertezaexpandida); end save GEU_GUM

You might also like