function varargout = control2(varargin)
% CONTROL2 M-file for control2.fig
% CONTROL2, by itself, creates a new CONTROL2 or raises the existing
% singleton*.
%
% H = CONTROL2 returns the handle to a new CONTROL2 or the handle to
% the existing singleton*.
%
% CONTROL2('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CONTROL2.M with the given input arguments.
%
% CONTROL2('Property','Value',...) creates a new CONTROL2 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before control2_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to control2_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 control2
% Last Modified by GUIDE v2.5 12-May-2012 18:14:55
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @control2_OpeningFcn, ...
'gui_OutputFcn', @control2_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 control2 is made visible.
function control2_OpeningFcn(hObject, eventdata, handles, varargin)
a=imread('cuadro_blanco_fondo_blanco_malevich.jpg');
image(a)
axis off
% 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 control2 (see VARARGIN)
% Choose default command line output for control2
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes control2 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = control2_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 ingreso_Callback(hObject, eventdata, handles)
% hObject handle to ingreso (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 ingreso as text
% str2double(get(hObject,'String')) returns contents of ingreso as a double
% --- Executes during object creation, after setting all properties.
function ingreso_CreateFcn(hObject, eventdata, handles)
% hObject handle to ingreso (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)
% 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)
global jime
global V
uno=get(handles.ingreso,'string');
jime=str2num(uno);
set(handles.a1,'String',jime);%Numerador
V=jime;
n=length(V);
for i=1:n
for j=1:n-i
if V(j)>V(j+1)
aux=V(j);
V(j)=V(j+1);
V(j+1)=aux;
end
end
end
ang=0;
for i=1:n
ang=V(i)+ang;
end
set(handles.b1,'String',V);%Numerador
med=ang/n;
ang=ang/2;
set(handles.c1,'String',ang);%Numerador
acu=0;
for i=1:n
ares=V(i)-med;
if ares<0
ares=ares*(-1);
end
acu=ares+acu;
end
acu=acu/n
set(handles.d1,'String',acu);%Numerador
function ingreso2_Callback(hObject, eventdata, handles)
% hObject handle to ingreso2 (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 ingreso2 as text
% str2double(get(hObject,'String')) returns contents of ingreso2 as a double
% --- Executes during object creation, after setting all properties.
function ingreso2_CreateFcn(hObject, eventdata, handles)
% hObject handle to ingreso2 (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 pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global jime
global V
ver=length(V);
if ver==0
errordlg({'Hola','Ingrese al menos un dato antes de buscar', 'SaludoS'},'Error Error Busqueda K')
end
uno=get(handles.ingreso2,'string');
jime=str2num(uno);
veri=length(jime);
if jime==0
errordlg({'Hola','El factor a buscar no debe ser 0 o vector', 'SaludoS'},'Error Busqueda K')
end
if veri>1
errordlg({'Hola','El factor a buscar no debe ser 0 o vector', 'SaludoS'},'Error Error Busqueda K')
end
% poner control aqui
n=length(V);
saku=0;
for i=1:n
if jime(1)==V(i);
x(i)=i;
saku=saku+1;
end
end
n=length(x);
angel=1;
for i=1:n
if x(i)>0
y(angel)=x(i);
angel=angel+1;
end
end
if saku==0
errordlg({'Hola','El numero ingresado no existe', 'SaludoS'},'Error Busqueda K')
end
set(handles.e1,'String',y);%Numerador