código de interfaz 2

Download Código de Interfaz 2

If you can't read please download the document

Upload: javi-lopez

Post on 05-Dec-2015

212 views

Category:

Documents


0 download

DESCRIPTION

Código para la realización de una interfaz gráfica con matlab

TRANSCRIPT

function varargout = Practica2_Javier_Jonathan(varargin)% PRACTICA2_JAVIER_JONATHAN MATLAB code for Practica2_Javier_Jonathan.fig% PRACTICA2_JAVIER_JONATHAN, by itself, creates a new PRACTICA2_JAVIER_JONATHAN or raises the existing% singleton*.%% H = PRACTICA2_JAVIER_JONATHAN returns the handle to a new PRACTICA2_JAVIER_JONATHAN or the handle to% the existing singleton*.%% PRACTICA2_JAVIER_JONATHAN('CALLBACK',hObject,eventData,handles,...) calls the local% function named CALLBACK in PRACTICA2_JAVIER_JONATHAN.M with the given input arguments.%% PRACTICA2_JAVIER_JONATHAN('Property','Value',...) creates a new PRACTICA2_JAVIER_JONATHAN or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before Practica2_Javier_Jonathan_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to Practica2_Javier_Jonathan_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 Practica2_Javier_Jonathan% Last Modified by GUIDE v2.5 20-Sep-2015 15:40:50% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @Practica2_Javier_Jonathan_OpeningFcn, ... 'gui_OutputFcn', @Practica2_Javier_Jonathan_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []);if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1});endif 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 Practica2_Javier_Jonathan is made visible.function Practica2_Javier_Jonathan_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 Practica2_Javier_Jonathan (see VARARGIN)% Choose default command line output for Practica2_Javier_Jonathanhandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes Practica2_Javier_Jonathan wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = Practica2_Javier_Jonathan_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 structurevarargout{1} = handles.output;% --- 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)%AQUI DEBE IR LA RUTA DONDE ESTA LA IMAGENimage=imread('C:\Users\Xnoriega\Documents\MATLAB\Image\bmp\rostro.bmp');axes(handles.imagen);imshow(image)[N M]=size(image);total=N*M;count_zero=0;count_ones=0;for i=1:N for j=1:M if image(i,j)==0 count_zero=count_zero+1; else count_ones=count_ones+1; end endendp_zero=count_zero/total;p_ones=count_ones/total;entropy=p_zero*(log2(1/p_zero))+(p_ones*(log2(1/p_ones)));entropy_ceil=ceil(entropy);set(handles.text_entalpia,'String',entropy);