Vous êtes sur la page 1sur 7

CDIGO FUENTE EN MATLAB: PRDIDAS POR FRICCIN EN ACCESORIOS

MENORES
function varargout = DISMINUCION_ACESORIOS_MENORES2(varargin)
% Last Modified by GUIDE v2.5 15-Sep-2014 12:10:31
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',
mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn',
@DISMINUCION_ACESORIOS_MENORES2_OpeningFcn, ...
'gui_OutputFcn',
@DISMINUCION_ACESORIOS_MENORES2_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 DISMINUCION_ACESORIOS_MENORES2 is made


visible.
function DISMINUCION_ACESORIOS_MENORES2_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 DISMINUCION_ACESORIOS_MENORES2
(see VARARGIN)
% Choose default command line output for DISMINUCION_ACESORIOS_MENORES2
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes DISMINUCION_ACESORIOS_MENORES2 wait for user response (see
UIRESUME)
% uiwait(handles.figure1);

%Coloca una imagen en cada botn


[a,map]=imread('uno.jpg');
[r,c,d]=size(a);
x=ceil(r/107);

y=ceil(c/85);
g=a(1:x:end,1:y:end,:);
g(g==255)=5.5*255;
set(handles.pushbutton1,'CData',g);
[a,map]=imread('dos.jpg');
[r,c,d]=size(a);
x=ceil(r/90);
y=ceil(c/85);
g=a(1:x:end,1:y:end,:);
g(g==255)=5.5*255;
set(handles.pushbutton2,'CData',g);
[a,map]=imread('tres.jpg');
[r,c,d]=size(a);
x=ceil(r/90);
y=ceil(c/85);
g=a(1:x:end,1:y:end,:);
g(g==255)=5.5*255;
set(handles.pushbutton3,'CData',g);
[a,map]=imread('cuatro.jpg');
[r,c,d]=size(a);
x=ceil(r/100);
y=ceil(c/85);
g=a(1:x:end,1:y:end,:);
g(g==255)=5.5*255;
set(handles.pushbutton4,'CData',g);
[a,map]=imread('cinco.jpg');
[r,c,d]=size(a);
x=ceil(r/100);
y=ceil(c/85);
g=a(1:x:end,1:y:end,:);
g(g==255)=5.5*255;
set(handles.pushbutton5,'CData',g);
[a,map]=imread('seis.jpg');
[r,c,d]=size(a);
x=ceil(r/100);
y=ceil(c/100);
g=a(1:x:end,1:y:end,:);
g(g==255)=5.5*255;
set(handles.pushbutton6,'CData',g);
[a,map]=imread('siete.jpg');
[r,c,d]=size(a);
x=ceil(r/100);
y=ceil(c/85);
g=a(1:x:end,1:y:end,:);
g(g==255)=5.5*255;
set(handles.pushbutton7,'CData',g);
[a,map]=imread('ocho.jpg');
[r,c,d]=size(a);
x=ceil(r/100);

y=ceil(c/85);
g=a(1:x:end,1:y:end,:);
g(g==255)=5.5*255;
set(handles.pushbutton8,'CData',g);
[a,map]=imread('nueve.jpg');
[r,c,d]=size(a);
x=ceil(r/100);
y=ceil(c/85);
g=a(1:x:end,1:y:end,:);
g(g==255)=5.5*255;
set(handles.pushbutton9,'CData',g);
[a,map]=imread('diez.jpg');
[r,c,d]=size(a);
x=ceil(r/100);
y=ceil(c/85);
g=a(1:x:end,1:y:end,:);
g(g==255)=5.5*255;
set(handles.pushbutton10,'CData',g);
[a,map]=imread('once.png');
[r,c,d]=size(a);
x=ceil(r/100);
y=ceil(c/85);
g=a(1:x:end,1:y:end,:);
g(g==255)=5.5*255;
set(handles.pushbutton11,'CData',g);
[a,map]=imread('once.png');
[r,c,d]=size(a);
x=ceil(r/100);
y=ceil(c/85);
g=a(1:x:end,1:y:end,:);
g(g==255)=5.5*255;
set(handles.pushbutton12,'CData',g);
[a,map]=imread('trece.jpg');
[r,c,d]=size(a);
x=ceil(r/100);
y=ceil(c/85);
g=a(1:x:end,1:y:end,:);
g(g==255)=5.5*255;
set(handles.pushbutton13,'CData',g);
[a,map]=imread('catorce.jpg');
[r,c,d]=size(a);
x=ceil(r/100);
y=ceil(c/85);
g=a(1:x:end,1:y:end,:);
g(g==255)=5.5*255;
set(handles.pushbutton14,'CData',g);

%matriz de datos
M1=[0.12 5.18 2.44 1.22 0.46 0.3 1;

0.15 6.71 3.36 1.83 0.61 0.45 1.37;


0.18 8.24 4.27 2.44 0.82 0.52 1.74;
0.24 11 5.49 3.66 1.07 0.7 2.32;
0.3 13.12 6.71 4.27 1.31 0.82 2.74;
0.36 16.78 8.24 5.8 1.68 1.07 3.66;
0.43 20.43 10.06 7.01 1.98 1.28 4.27;
0.52 25.01 12.5 9.76 2.44 1.59 5.18;
0.7 33.55 16.16 13.12 3.36 2.14 6.71;
0.88 42.7 21.35 17.69 4.27 2.74 8.24;
1.07 51.85 24.4 20.74 4.88 3.36 10;
1.37 68.02 36.6 29.36 6.1 4.27 13.12;
1.77 85.4 42.7 38.05 7.93 5.18 16.16;
2.07 100.65 48.8 47.02 9.76 6.1 20.74;
2.44 115.9 58 56.24 11.28 7.32 23.79;
2.74 134.2 67.1 65.68 12.81 8.24 26.84];
M2=[1 0.24 1.09 0.3 0.18 0.27 0.49;
1.37 0.3 1.52 0.45 0.24 0.4 0.61;
1.74 0.4 1.83 0.52 0.3 0.46 0.76;
2.32 0.51 2.53 0.7 0.4 0.61 1.04;
2.74 0.61 3.05 0.82 0.45 0.73 1.22;
3.66 0.76 3.96 1.07 0.58 0.91 1.52;
4.27 0.92 4.58 1.28 0.67 1.1 1.83;
5.18 1.16 5.49 1.59 0.85 1.37 2.38;
6.71 1.52 7.32 2.14 1.16 1.83 3.26;
8.24 1.92 9.46 2.74 1.43 2.29 4.12;
10 2.29 11.28 3.36 1.77 2.74 4.7;
13.12 3.05 15.55 4.27 2.29 3.96 6.07;
16.16 3.96 18.6 5.18 3.05 4.58 7.47;
20.74 4.58 22.57 6.1 3.66 5.49 9.09;
23.79 5.18 25.92 7.32 3.96 6.1 10.64;
26.84 5.8 30.5 8.24 4.58 7.02 12.2];
global M
M(:,1)=M1(:,1);
M(:,2)=M1(:,2);
M(:,3)=M1(:,3);
M(:,4)=M1(:,4);
M(:,5)=M1(:,5);
M(:,6)=M1(:,6);
M(:,7)=M2(:,2);
M(:,8)=M2(:,3);
M(:,9)=M1(:,7);
M(:,10)=M2(:,1);
M(:,11)=M2(:,4);
M(:,12)=M2(:,5);
M(:,13)=M2(:,6);
M(:,14)=M2(:,7);
M

% --- Outputs from this function are returned to the command line.

function varargout = DISMINUCION_ACESORIOS_MENORES2_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 pushbutton1.


function pushbutton1_Callback(hObject, eventdata, handles)
global M y
L=M(y,1)
set(handles.resultado,'String',L)

% --- Executes on button press in pushbutton11.


function pushbutton13_Callback(hObject, eventdata, handles)
global M y
L=M(y,13)
set(handles.resultado,'String',L)
% --- Executes on button press in pushbutton12.
function pushbutton15_Callback(hObject, eventdata, handles)
global M y
L=M(y,15)
set(handles.resultado,'String',L)
% --- Executes on button press in pushbutton11.
function pushbutton9_Callback(hObject, eventdata, handles)
global M y
L=M(y,9)
set(handles.resultado,'String',L)
% --- Executes on button press in pushbutton12.
function pushbutton12_Callback(hObject, eventdata, handles)
global M y
L=M(y,12)
set(handles.resultado,'String',L)
% --- Executes on button press in pushbutton13.
function pushbutton11_Callback(hObject, eventdata, handles)
global M y
L=M(y,11)
set(handles.resultado,'String',L)
% --- Executes on button press in pushbutton14.
function pushbutton14_Callback(hObject, eventdata, handles)
global M y
L=M(y,14)
set(handles.resultado,'String',L)
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
global M y

L=M(y,5)
set(handles.resultado,'String',L)
% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata,
global M y
L=M(y,6)
set(handles.resultado,'String',L)
% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata,
global M y
L=M(y,7)
set(handles.resultado,'String',L)
% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata,
global M y
L=M(y,8)
set(handles.resultado,'String',L)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata,
global M y
L=M(y,2)
set(handles.resultado,'String',L)

handles)

handles)

handles)

handles)

% --- Executes on button press in pushbutton3.


function pushbutton3_Callback(hObject, eventdata, handles)
global M y
L=M(y,3)
set(handles.resultado,'String',L)
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
global M y
L=M(y,4)
set(handles.resultado,'String',L)
% --- Executes on selection change in selec.
function selec_Callback(hObject, eventdata, handles)
d=get(handles.selec,'Value');
global y
if d==1
y=1
else if
y=2
else if
y=3
else if
y=4
else if
y=5
else if
y=6
else if
y=7
else if
y=8

d==2
d==3
d==4
d==5
d==6
d==7
d==8

else
y=9
else
y=10
else
y=11
else
y=12
else
y=13
else
y=14
else
y=15
else
y=16
else
y=1

if d==9
if d==10
if d==11
if d==12
if d==13
if d==14
if d==15
if d==16

end
end
end
end
end
end
end
end
end
end
end
end
end
end
end

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

% --- Executes during object creation, after setting all properties.


function resultado_CreateFcn(hObject, eventdata, handles)
% hObject
handle to resultado (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB

Vous aimerez peut-être aussi