function varargout = guardart(varargin) % GUARDART M-file for guardart.fig % GUARDART, by itself, creates a new GUARDART or raises the existing % singleton*. % % H = GUARDART returns the handle to a new GUARDART or the handle to % the existing singleton*. % % GUARDART('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in GUARDART.M with the given input arguments. % % GUARDART('Property','Value',...) creates a new GUARDART or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before guardart_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to guardart_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 guardart % Last Modified by GUIDE v2.5 12-Nov-2005 20:23:30 %DEFINICIÓN DE FUNCIÓN %Función que nos permite seleccionar los datos temporales que deseamos %almacenary el formato. %Como parámetros de entrada tenemos todos los datos de las señales %capturadas, tanto originales como filtradas, sus estadísticas y los %máximos y mínimos locales respectivamente. % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @guardart_OpeningFcn, ... 'gui_OutputFcn', @guardart_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 guardart is made visible. function guardart_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 guardart (see VARARGIN) % Choose default command line output for guardart handles.output = hObject; flagmat = 0; %0 no se guarda y 1 se guarda en .mat flagwk1 = 0; %0 no se guarda y 1 se guarda en .wk1 flaghtml = 0; %0 no se guarda y 1 se crea un html flagdoc = 0; %0 no se guarda y 1 se crea un doc flagoriginales = 0; %0 no se guarda y 1 se guarda los datos originales flagfiltrados = 0; %0 no se guarda y 1 se guardan los dato filtrados flagestadistica= 0; %0 no se guarda y 1 se guardan las estadísticas flaglocales = 0; %0 no se guarda y 1 se guardan los max y min locales directorio = ''; %Directorio donde se almacena el archivo wk1 nombre = ''; %Nombre del archivo wk1 directoriom= ''; %Directorio donde se almacena el archivo mat nombrem = ''; %Nombre de la carpeta donde se guardan las variables mat handles.flagmat = flagmat; handles.flagwk1 = flagwk1; handles.flaghtml = flaghtml; handles.flagdoc = flagdoc; handles.flagoriginales = flagoriginales; handles.flagfiltrados = flagfiltrados; handles.flagestadistica = flagestadistica; handles.flaglocales = flaglocales; handles.directorio = directorio; handles.nombre = nombre; handles.directoriom = directorio; handles.nombrem = nombre; handles.X = varargin{1}; handles.Y = varargin{2}; handles.Xb = varargin{3}; handles.Yb = varargin{4}; handles.maximot = varargin{5}; handles.minimot = varargin{6}; handles.medianat = varargin{7}; handles.mediat = varargin{8}; handles.desvt = varargin{9}; handles.xmaximolocalt = varargin{10}; handles.ymaximolocalt = varargin{11}; handles.xminimolocalt = varargin{12}; handles.yminimolocalt = varargin{13}; % Update handles structure guidata(hObject, handles); % UIWAIT makes guardart wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = guardart_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 mat_push. function mat_push_Callback(hObject, eventdata, handles) % hObject handle to mat_push (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %Deseamos almacenar los datos seleccionados en archivos en una carpeta de %nombre resultadost nombrem = ''; directoriom= ''; salir = 0; flagmat = 1; %almacenamos los datos en .mat [nombrem,directorio,salir]=uiputfile('*.*','GUARDART DATOS'); handles.nombrem=nombrem; handles.directoriom=directoriom; if salir==1 set(handles.mat_push,'BackgroundColor',[0 0 1]); handles.flagmat = flagmat; warndlg(strcat('Al pulsar GUARDAR se creará la carpeta:',directorio,nombrem,'_con los archivos seleccionados'),'AVISO'); else warndlg('AVISO: No se ha seleccionado e formato','AVISO'); end guidata(hObject,handles) % --- Executes on button press in wk1_push. function wk1_push_Callback(hObject, eventdata, handles) % hObject handle to wk1_push (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %Deseamos almacenar los datos en un archivo de extensión wk1 cuyo nombre y %directorio lo selecciona el usuario nombre = ''; %Nombre del archivo directorio = ''; %Direntorio donde se almacena el archivo salir = 0; %0 se pulsa el aspa o cancelar y 1 introducimos un nombre set(handles.wk1_push,'BackgroundColor',[0 0 1]); %solicitamos al usuario que introduzca el nombre del archivo y donde lo %quiere [nombre,directorio,salir]=uiputfile('*.wk1','GUARDART DATOS'); handles.nombre=nombre; handles.directorio=directorio; if salir==1 handles.flagwk1=1; warndlg(strcat('Al pulsar GUARDAR se almacenarán los datos seleccionados en:',... nombre,'en ',directorio),'AVISO'); else %si el usuario se sale pulsando el aspa o dando a cancelar no se crea %ningún archivo errordlg('No se ha seleccionado el formato','ERROR') set(handles.wk1_push,'BackgroundColor',[0.925 0.914 0.845]) end guidata(hObject,handles) % --- Executes on button press in html_push. function html_push_Callback(hObject, eventdata, handles) % hObject handle to html_push (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %Se desea crear un informe de tipo html handles.flaghtml=1; set(handles.html_push,'BackgroundColor',[0 0 1]); warndlg('Al pulsar GUARDAR se creará el archivo html','AVISO') guidata(hObject,handles) % --- Executes on button press in doc_push. function doc_push_Callback(hObject, eventdata, handles) % hObject handle to doc_push (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %Se desea crear un informe de tipo doc set(handles.doc_push,'BackgroundColor',[0 0 1]); handles.flagdoc=1; warndlg('Al pulsar GUARDAR se creará el archivo doc','AVISO') guidata(hObject,handles) % --- Executes on button press in guardarinf_push. function guardarinf_push_Callback(hObject, eventdata, handles) % hObject handle to guardarinf_push (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) %Una vez seleccionado los datos y la forma de almacenar los datos, se %procede a su almacen if handles.flaghtml==1 %Se desea crear un informe con los datos en el dominio temporal publish('result','html'); closereq closereq closereq end if handles.flaghtml==0 & handles.flagdoc==0 warndlg('AVISO: No se ha seleccionado nada para guardar','AVISO'); end % --- 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) helpdlg('Primero debe seleccionar los datos que desea almacenar y el formato y luego pulsar GUARDAR','AYUDA'); % --- 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) %Se reinician todas los datos seleccionados y posteriormente %invitamos al usuario a introducir los nuevos datos handles.flaghtml = 0; handles.flagdoc = 0; %limpiamos todos los botones set(handles.html_push,'BackgroundColor',[0.925 0.914 0.845]) set(handles.doc_push,'BackgroundColor',[0.925 0.914 0.845]) warndlg('Vuelva a seleccionar los archivos que desea generar','AVISO') guidata(hObject,handles) % --- Executes on button press in originales_box. function originales_box_Callback(hObject, eventdata, handles) % hObject handle to originales_box (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if get(hObject,'Value')==get(hObject,'Max') handles.flagoriginales=1; else handles.flagoriginales=0; end guidata(hObject,handles) % --- Executes on button press in filtrado_box. function filtrado_box_Callback(hObject, eventdata, handles) % hObject handle to filtrado_box (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if get(hObject,'Value')==get(hObject,'Max') handles.flagfiltrados=1; else handles.flagfiltrados=0; end guidata(hObject,handles) % --- Executes on button press in estadisticas_box. function estadisticas_box_Callback(hObject, eventdata, handles) % hObject handle to estadisticas_box (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if(get(hObject,'Value')==get(hObject,'Max')) handles.flagestadistica=1; else handles.flagestadistica=0; end guidata(hObject,handles) % --- Executes on button press in locales_box. function locales_box_Callback(hObject, eventdata, handles) % hObject handle to locales_box (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) if get(hObject,'Value')==get(hObject,'Max') handles.flaglocales=1; else handles.flaglocales=0; end guidata(hObject,handles) % --- Executes on button press in guardarfich_push. function guardarfich_push_Callback(hObject, eventdata, handles) % hObject handle to guardarfich_push (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) X = handles.X; Y = handles.Y; Xb = handles.Xb; Yb = handles.Yb; maximot = handles.maximot; minimot = handles.minimot; medianat = handles.medianat; mediat = handles.mediat; desvt = handles.desvt; xmaximolocalt = handles.xmaximolocalt; ymaximolocalt = handles.ymaximolocalt; xminimolocalt = handles.xminimolocalt; yminimolocalt = handles.yminimolocalt; directorio = handles.directorio; nombre = handles.nombre; directoriom = handles.directoriom; nombrem =handles.nombrem; [m,n] = size(Xb); A = []; %matriz para crear el archivo wk1 B = []; if handles.flagmat==1 %Se desean almacenar los datos en un archivo ,mat direc=pwd; mkdir(directoriom,nombrem) %creamos la carpeta resultadost cd(strcat(directoriom,nombrem)) if handles.flagestadistica==1 save estadisticas maximot minimot medianat mediat desvt; end if handles.flagfiltrados==1 save filtrado Xb Yb; end if handles.flagoriginales==1 save originales X Y; end if handles.flaglocales==1 save locales xmaximolocalt ymaximolocalt xminimolocalt yminimolocalt; end cd(direc) end if handles.flagwk1==1 %Se desean almacenar lo datos en formato wk1 if handles.flagoriginales==1 A=[A,X' X' Y]; end if handles.flagfiltrados==1 A=[A, Xb Yb]; end if handles.flagestadistica==1 B=[maximot minimot medianat mediat desvt;zeros(m-1,5*n)]; A=[A,B]; end if handles.flaglocales==1 A=[A,xmaximolocalt ymaximolocalt xminimolocalt yminimolocalt]; end wk1write(strcat(directorio,nombre),A); end if handles.flagmat==0 & handles.flagwk1==0 warndlg('AVISO: No se ha seleccionado nada para guardar','AVISO'); end % --- Executes on button press in deshacerfic_push. function deshacerfic_push_Callback(hObject, eventdata, handles) % hObject handle to deshacerfic_push (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) handles.flagmat = 0; handles.flagwk1 = 0; %limpiamos todos los botones set(handles.wk1_push,'BackgroundColor',[0.925 0.914 0.845]) set(handles.mat_push,'BackgroundColor',[0.925 0.914 0.845]) %limpiamos las casillas de los datos set(handles.originales_box,'Value',0); set(handles.filtrado_box,'Value',0); set(handles.estadisticas_box,'Value',0); set(handles.locales_box,'Value',0); warndlg('Vuelva a seleccionar los archivos que desea generar','AVISO') guidata(hObject,handles) % --- Executes on button press in siguiente_push. function siguiente_push_Callback(hObject, eventdata, handles) % hObject handle to siguiente_push (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) closereq