0% found this document useful (0 votes)
44 views4 pages

Estudiante: Fausto Polanco 1. Adquisición de Datos:: 'Registro - XLS'

The document contains code for creating a graphical user interface (GUI) in MATLAB. It includes functions for initializing the GUI, opening and closing the GUI window, and callback functions for GUI components like popup menus and buttons. The GUI is designed to load and plot data from files of athlete names, countries, and times for different distances.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views4 pages

Estudiante: Fausto Polanco 1. Adquisición de Datos:: 'Registro - XLS'

The document contains code for creating a graphical user interface (GUI) in MATLAB. It includes functions for initializing the GUI, opening and closing the GUI window, and callback functions for GUI components like popup menus and buttons. The GUI is designed to load and plot data from files of athlete names, countries, and times for different distances.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Estudiante: Fausto Polanco

1. Adquisición de datos:
2. Matrix=importdata('Registro.xls')
3. apellidos=Matrix.textdata.Apellidos;
4. apellidos(1,:)=[];
5. pais=Matrix.textdata.Pa0xEDs;
6. pais(1,:)=[];
7. tiempos=Matrix.data.Tiempos;
8. tiempos(:,1)=[];
9. save apellidos
10. save pais
11. save tiempos

2. Código

function varargout = interfaz(varargin)


% INTERFAZ MATLAB code for interfaz.fig
% INTERFAZ, by itself, creates a new INTERFAZ or raises the existing
% singleton*.
% H = INTERFAZ returns the handle to a new INTERFAZ or the handle to
% the existing singleton*.
% INTERFAZ('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in INTERFAZ.M with the given input arguments.
% INTERFAZ('Property','Value',...) creates a new INTERFAZ or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before interfaz_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to interfaz_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 interfaz

% Last Modified by GUIDE v2.5 06-May-2019 22:06:17

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @interfaz_OpeningFcn, ...
'gui_OutputFcn', @interfaz_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 interfaz is made visible.


function interfaz_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 interfaz (see VARARGIN)

% Choose default command line output for interfaz


handles.output = hObject;

% Update handles structure


guidata(hObject, handles);

% UIWAIT makes interfaz wait for user response (see UIRESUME)


% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = interfaz_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 selection change in popupmenu1.


function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as


cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1

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


function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu1 (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 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)
load apellidos.mat
load pais.mat
load tiempos.mat
indice=get(handles.popupmenu1,'Value');
nom=apellidos(indice);
set(handles.text4,'String',pais(indice));
distancias=[50 100 150 200];
plot(handles.axes1,distancias,tiempos(indice,:),'r--')
title(handles.axes1,'Distancia vs Tiempo Competidor');
xlabel(handles.axes1,'Distancia [m]');ylabel(handles.axes1,'Tiempo [s]');
legend(handles.axes1,nom);

% --- 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)
load apellidos.mat
load tiempos.mat
distancias=[50 100 150 200];
plot(handles.axes2,distancias,tiempos(1,:),'k*-');
hold on
plot(handles.axes2,distancias,tiempos(2,:),'go-');
plot(handles.axes2,distancias,tiempos(3,:),'bs-');
plot(handles.axes2,distancias,tiempos(4,:),'r');
plot(handles.axes2,distancias,tiempos(5,:),'ms-');
plot(handles.axes2,distancias,tiempos(6,:),'c:');
plot(handles.axes2,distancias,tiempos(7,:),'b--o');
plot(handles.axes2,distancias,tiempos(8,:),'--gs');
hold off
legend(handles.axes2,'Ford','Zamorano','Caldwell','Sven','Hocking','Wuang','Ferna
ndez','Paredes');
xlabel(handles.axes2,'Distancia [m]');
ylabel(handles.axes2,'Tiempo [s]');
3. Interfaz

You might also like