Pernos

Embed Size (px)

DESCRIPTION

Codigo gui

Citation preview

function varargout = Pernos(varargin)gui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @Pernos_OpeningFcn, ... 'gui_OutputFcn', @Pernos_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []);if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1});endif nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});else gui_mainfcn(gui_State, varargin{:});endfunction Pernos_OpeningFcn(hObject, eventdata, handles, varargin)axes1 = imread('metrica.jpg');axes(handles.axes1);axis off;imshow(axes1);handles.output = hObject;guidata(hObject, handles);function varargout = Pernos_OutputFcn(hObject, eventdata, handles) varargout{1} = handles.output; function poprosca_CreateFcn(hObject, eventdata, handles)if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');endfunction popgrados_Callback(hObject, eventdata, handles)function popgrados_CreateFcn(hObject, eventdata, handles)if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');endfunction diametro_Callback(hObject, eventdata, handles)function diametro_CreateFcn(hObject, eventdata, handles)if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');endfunction paso_Callback(hObject, eventdata, handles)function paso_CreateFcn(hObject, eventdata, handles)if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white');endfunction poprosca_Callback(hObject, eventdata, handles)g = get(handles.poprosca, 'Value');switch g case 1 axes1 = imread('metrica.jpg'); axes(handles.axes1); axis off; imshow(axes1); handles.output = hObject; guidata(hObject, handles); case 2 axes1 = imread('withworth.jpg'); axes(handles.axes1); axis off; imshow(axes1); handles.output = hObject; guidata(hObject, handles);endfunction cmdpush_Callback(~, ~, handles)r = get(handles.popgrados, 'Value');switch r case 1 t = 40; f = 24; case 2 t = 80; f = 64; case 3 t = 120; f = 98;endg = get(handles.poprosca, 'Value');switch g case 1 d = str2double(get(handles.diametro, 'string')); b = str2double(get(handles.b, 'string')); p = str2double(get(handles.paso, 'string')); if b 1 warndlg('Solo usar en withworth','Advertencia'); end if d