function varargout = mcCullochPitts(varargin) % MCCULLOCHPITTS M-file for mcCullochPitts.fig % MCCULLOCHPITTS, by itself, creates a new MCCULLOCHPITTS or raises the existing % singleton*. % % H = MCCULLOCHPITTS returns the handle to a new MCCULLOCHPITTS or the handle to % the existing singleton*. % % MCCULLOCHPITTS('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in MCCULLOCHPITTS.M with the given input arguments. % % MCCULLOCHPITTS('Property','Value',...) creates a new MCCULLOCHPITTS or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before mcCullochPitts_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to mcCullochPitts_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 mcCullochPitts % Last Modified by GUIDE v2.5 04-Mar-2010 14:52:26 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @mcCullochPitts_OpeningFcn, ... 'gui_OutputFcn', @mcCullochPitts_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 mcCullochPitts is made visible. function mcCullochPitts_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 mcCullochPitts (see VARARGIN) % Choose default command line output for mcCullochPitts handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes mcCullochPitts wait for user response (see UIRESUME) % uiwait(handles.figure1); set(handles.result1,'String','-'); set(handles.result2,'String','-'); set(handles.result3,'String','-'); set(handles.result4,'String','-'); set(handles.axes1,'XLim',[-0.25 1.25]); set(handles.axes1,'YLim',[-0.25 1.25]); % ht1=text(1,1,'Listo'); % % function changeT(string) % set(ht1,'String',string); %guidata(handles,ht1); % --- Outputs from this function are returned to the command line. function varargout = mcCullochPitts_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 umbral=str2double(get(hObject,'String')); if isnan(umbral) set(hObject,'String',num2str(0.5)); else set(handles.slider1,'Value',umbral); end % --- 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 set(hObject,'String',num2str(0.5)); % 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 slider movement. function slider1_Callback(hObject, eventdata, handles) % hObject handle to slider1 (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,'Value') returns position of slider % get(hObject,'Min') and get(hObject,'Max') to determine range of slider set(handles.edit1,'String',num2str(get(hObject,'Value'))); % --- Executes during object creation, after setting all properties. function slider1_CreateFcn(hObject, eventdata, handles) % hObject handle to slider1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called set(hObject,'Min',-1.0); set(hObject,'Value',0.5); % Hint: slider controls usually have a light gray background. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); 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 umbral=str2double(get(hObject,'String')); if isnan(umbral) set(hObject,'String',num2str(0.5)); else set(handles.slider2,'Value',umbral); end % --- 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 set(hObject,'String',num2str(0.5)); % 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 slider movement. function slider2_Callback(hObject, eventdata, handles) % hObject handle to slider2 (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,'Value') returns position of slider % get(hObject,'Min') and get(hObject,'Max') to determine range of slider set(handles.edit2,'String',num2str(get(hObject,'Value'))); % --- Executes during object creation, after setting all properties. function slider2_CreateFcn(hObject, eventdata, handles) % hObject handle to slider2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called set(hObject,'Min',-1.0); set(hObject,'Value',0.5); % Hint: slider controls usually have a light gray background. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); 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 umbral=str2double(get(hObject,'String')); if isnan(umbral) set(hObject,'String',num2str(0.5)); else set(handles.slider3,'Value',umbral); end % --- 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 set(hObject,'String',num2str(0.5)); % 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 slider movement. function slider3_Callback(hObject, eventdata, handles) % hObject handle to slider3 (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,'Value') returns position of slider % get(hObject,'Min') and get(hObject,'Max') to determine range of slider set(handles.edit3,'String',num2str(get(hObject,'Value'))); % --- Executes during object creation, after setting all properties. function slider3_CreateFcn(hObject, eventdata, handles) % hObject handle to slider3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called set(hObject,'Min',-1.0); set(hObject,'Value',0.5); % Hint: slider controls usually have a light gray background. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end % --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) % 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) %delete(ht1); umbral=str2double(get(handles.edit1,'String')); pes1=str2double(get(handles.edit2,'String')); pes2=str2double(get(handles.edit3,'String')); %pes1 %pes2 cond=[1 1; 1 0; 0 1]; res=cond*[pes1;pes2]-umbral; %lres=logical(res); %text(0.2,0.4,'Entrada 1') %text(0.5,0.4,'Entrada 2') %text(0.8,0.4,'Salida') %text(0.25,0.35,'1') %text(0.55,0.35,'1') %ht1 =text(1,1,num2str( res(1)>0 )); %set(ht1,'String','opa'); set(handles.result1,'String',num2str( res(1)>0)); colores={'or','or','or','ob'}; res>0 colores(res>0)={'ob'}; if umbral>0 colores(end)={'or'}; end hold off plot(1,1,colores{1}) hold on %text(0.25,0.30,'1') %text(0.55,0.30,'0') %text(0.83,0.30,num2str( res(2)>0 )) set(handles.result2,'String',num2str( res(2)>0)); plot(1,0,colores{2}) %text(0.25,0.25,'0') %text(0.55,0.25,'1') %text(0.83,0.25,num2str( res(3)>0 )) set(handles.result3,'String',num2str( res(3)>0)); plot(0,1,colores{3}) %text(0.25,0.20,'0') %text(0.55,0.20,'0') %text(0.83,0.20,num2str( umbral<0 )) set(handles.result4,'String',num2str( umbral<0)); plot(0,0,colores{4}) %linea plot((-0.1:.1:(1.1)), (umbral - pes1.*(-0.1:.1:(1.1)))./pes2,'-b'); set(handles.axes1,'XLim',[-0.25 1.25]); set(handles.axes1,'YLim',[-0.25 1.25]); xlabel('Entrada 1') ylabel('Entrada 2')