function varargout = datos_generales(varargin) % DATOS_GENERALES M-file for datos_generales.fig % DATOS_GENERALES, by itself, creates a new DATOS_GENERALES or raises the existing % singleton*. % % H = DATOS_GENERALES returns the handle to a new DATOS_GENERALES or the handle to % the existing singleton*. % % DATOS_GENERALES('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in DATOS_GENERALES.M with the given input arguments. % % DATOS_GENERALES('Property','Value',...) creates a new DATOS_GENERALES or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before datos_generales_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to datos_generales_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 % Copyright 2002-2003 The MathWorks, Inc. % Edit the above text to modify the response to help datos_generales % Last Modified by GUIDE v2.5 06-Nov-2005 18:48:27 %DEFINICIÓN DE LA FUNCIÓN % Función que solicita al usuario que introduzca el nombre del archivo que % debemos procesar, el número de canales conectados, la tasa de muestreo, % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @datos_generales_OpeningFcn, ... 'gui_OutputFcn', @datos_generales_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 datos_generales is made visible. function datos_generales_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 datos_generales (see VARARGIN) nombre = ''; %nombre del fichero canales = 0; %canales conectados tmuestreo = 0; %tiempo de muestreo flagaceptar = 0; %0 no aceptado y 1 aceptado flagnombre = 0; %0 si no se ha puesto un nombre y 1 eoc flagcanales = 0; %0 si no se ha introducido canales y 1 eoc flagtmuestreo= 0; %0 si no se ha introducido la tasa de muestreo y 1 eoc handles.nombre = nombre; handles.canales = canales; handles.tmuestreo = tmuestreo; handles.flagaceptar = flagaceptar; handles.flagnombre = flagnombre; handles.flagcanales = flagcanales; handles.flagtmuestreo = flagtmuestreo; % Update handles structure guidata(hObject, handles); % UIWAIT makes datos_generales wait for user response (see UIRESUME) uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = datos_generales_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 %Almacen de las variables de salida try varargout{1} = handles.nombre; varargout{2} = handles.canales; varargout{3} = handles.tmuestreo; varargout{4} = handles.flagaceptar; catch varargout{1} = []; varargout{2} = []; varargout{3} = []; varargout{4} = 0; end closereq % --- Executes on button press in nombre_push. function nombre_push_Callback(hObject, eventdata, handles) % hObject handle to nombre_push (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %Al pulsar el botón se solicita al usuario que seleccione un archivo en un %directorio determinado. Una vez seleccionado se almacena dicho nombre, el %directorio y la forma con que se ha salido de la ventana previa. nombre = ''; %Nombre del fichero directorio = ''; %Directorio donde se ubica el fichero flagsalida = 1; %1 salida correcta, 0 eoc [nombre,directorio,flagsalida]=uigetfile('*.wk1','Parámetros de las señales'); %Si se ha salido correctamente, se escribe el nombre en la casilla %correspondiente, y se pinta la casilla en azul. En caso contrario %se muestra un mensaje de error y se deja la casilla en blanco if flagsalida>0 handles.flagnombre=1; handles.nombre = nombre; set(handles.nombre_text,'String',nombre); set(handles.nombre_push,'BackgroundColor',[0 0 1]); else errordlg('ERROR: Debe seleccionar un archivo','ERROR') set(handles.nombre_push,'BackgroundColor',[0.925 0.914 0.847]); handles.flagnombre=0; end guidata(hObject,handles); % --- Executes on selection change in canales_popup. function canales_popup_Callback(hObject, eventdata, handles) % hObject handle to canales_popup (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns canales_popup contents as cell array % contents{get(hObject,'Value')} returns selected item from canales_popup %Capturamos el número de canales que se han conectado a la tarjeta de %adquisición de datos_generales canales = 0; canalesv = get(hObject,'Value'); canaless = get(hObject,'String'); canales = str2double(canaless(canalesv)); handles.canales = canales; if canales>0 handles.flagcanales=1; else errordlg('ERROR: Debe seleccionar un canal distinto de 0','ERROR'); handles.flagcanales=0; end guidata(hObject,handles); % --- Executes during object creation, after setting all properties. function canales_popup_CreateFcn(hObject, eventdata, handles) % hObject handle to canales_popup (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 set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on selection change in tmuestreo_popup. function tmuestreo_popup_Callback(hObject, eventdata, handles) % hObject handle to tmuestreo_popup (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: contents = get(hObject,'String') returns tmuestreo_popup contents as cell array % contents{get(hObject,'Value')} returns selected item from tmuestreo_popup %Seleccionamos el valor de la tasa con que se han muestreado los datos_generales tmuestreov=get(hObject,'Value'); tmuestreos=get(hObject,'String'); tmuestreo=str2double(tmuestreos(tmuestreov)); handles.tmuestreo = tmuestreo; if tmuestreo > 0 handles.flagtmuestreo=1; else warndlg('ERROR: Debe seleccionar una tasa de muestreo mayor que 0','ERROR'); handles.flagtmuestreo=0; end guidata(hObject,handles); % --- Executes during object creation, after setting all properties. function tmuestreo_popup_CreateFcn(hObject, eventdata, handles) % hObject handle to tmuestreo_popup (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 set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end % --- Executes on button press in aceptar_push. function aceptar_push_Callback(hObject, eventdata, handles) % hObject handle to aceptar_push (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %Se muestran todos los dato capturados previamente en la pantalla principal nombre = ''; canales = 0; tmuestreo = 0; handles.flagaceptar=1; guidata(hObject,handles); %obtenemos los valores que queremos almacenar en la pantalla principal if handles.flagnombre==1; nombre=handles.nombre; else warndlg('ERROR: Debe introducir un nombre de archivo','ERROR'); end if handles.flagcanales==1 canales=handles.canales; else warndlg('ERROR: Debe introducir el número de canales que se han conectado','ERROR'); end if handles.flagtmuestreo==1 tmuestreo=handles.tmuestreo; else warndlg('ERROR: Debe introducir la tasa de muestreo','ERROR'); end if ((handles.flagnombre==1) & (handles.flagcanales==1) & (handles.flagtmuestreo==1)) uiresume; end % --- Executes on button press in deshacer_push. function deshacer_push_Callback(hObject, eventdata, handles) % hObject handle to deshacer_push (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %Al pulsar dehacer, se almacenan todos los valores por defecto que se han %establecido al comienzo de esta pantalla y solicita al usuario que vuelva %a introducir todos los datos_generales handles.flagaceptar = 0; handles.nombre = ''; handles.canales = 0; handles.tmuestreo = 0; handles.flagaceptar = 0; handles.flagnombre = 0; handles.flagcanales = 0; handles.flagtmuestreo = 0; set(handles.nombre_push,'BackgroundColor',[0.925 0.914 0.847]); set(handles.nombre_text,'String',''); set(handles.canales_popup,'Value',1); set(handles.tmuestreo_popup,'Value',1); warndlg('AVISO:Debe volver a seleccionar todos los datos_generales','AVISO'); guidata(hObject,handles); % --- Executes on button press in cancelar_push. function cancelar_push_Callback(hObject, eventdata, handles) % hObject handle to cancelar_push (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %No se almacenan los datos_generales y se cierra la ventana handles.flagaceptar=0; guidata(hObject,handles); uiresume % --- Executes on button press in ayuda_push. function ayuda_push_Callback(hObject, eventdata, handles) % hObject handle to ayuda_push (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) h1=ayuda_datos_generales; waitfor(h1);