Práctica 11 Matlab PDF

Title Práctica 11 Matlab
Author Enrique Bravo Medrano
Course Programación avanzada
Institution Centro de Enseñanza Técnica y Superior
Pages 9
File Size 186.8 KB
File Type PDF
Total Downloads 55
Total Views 154

Summary

Práctica número once de programación avanzada, con código Matlab....


Description

Bravo Medrano Luis Enrique 033125 Marco Teórico set Establezca las propiedades del objeto. Set (H, 'PropertyName', PropertyValue) establece el valor de la especificada Propiedad del objeto gráfico con manecilla H. H puede ser un vector de , En cuyo caso set establece los valores de las propiedades para todos los objetos De H. Set (H, a) donde a es una estructura cuyos nombres de campo son propiedad de objeto Nombres, establece las propiedades nombradas en cada nombre de campo con los valores Contenido en la estructura. Set (H, pn, pv) establece las propiedades con nombre especificadas en la matriz de celdas de Cadenas pn a los valores correspondientes en la matriz de celdas pv para todos Objetos especificados en H. La matriz de celdas pn debe ser 1 por N, pero la celda Array pv puede ser M-by-N donde M es igual a longitud (H) de modo que cada Objeto se actualizará con un conjunto diferente de valores para la lista de Nombres de propiedad contenidos en pn. Set (H, 'PropertyName1', PropertyValue1, 'PropertyName2', PropertyValue2, ...) Establece varios valores de propiedad con una sola sentencia. Tenga en cuenta que Es posible utilizar pares de cadenas propiedad / valor, estructuras y Propiedad / valor pares de celdas en la misma llamada para establecer.

A = set (H, 'PropertyName') Set (H, 'PropertyName') Devuelve o muestra los valores posibles para la propiedad especificada de El objeto con la manija H. La matriz devuelta es una matriz de celdas de Posibles cadenas de valor o una matriz de celdas vacías si la propiedad no

Tienen un conjunto finito de valores de cadena posibles. get Obtener propiedades de objeto. V = get (H, 'PropertyName') devuelve el valor de la propiedad especificada Para el objeto gráfico con el identificador H. Si H es un vector de identificadores, Entonces get devolverá una matriz de celdas M-by-1 de valores donde M es igual A la longitud (H). Si se reemplaza 'PropertyName' por una celda 1 por N o N por 1 Array de cadenas que contienen nombres de propiedades, entonces get devolverá un Matriz de valores M-by-N. Get (H) muestra los nombres y los valores actuales de todos los user-gettable Propiedades del objeto gráfico con el identificador H. V = get (H) donde H es un escalar, devuelve una estructura donde cada campo Nombre es el nombre de una propiedad user-gettable de H y cada campo Contiene el valor de esa propiedad. V = get (0, 'Factory') V = get (0, 'Factory ') V = get (0, 'Factory ') Devuelve para todos los tipos de objetos los valores de fábrica de todas las propiedades Que tienen valores predeterminados por el usuario. V = get (H, 'Default') V = get (H, 'Default ') V = get (H, 'Default ') guidata Almacena o recupera los datos de la aplicación. Guidata (H, DATA) almacena los datos especificados en la figura Datos de la aplicación. H es una manija que identifica la figura - puede ser la figura Sí mismo, o cualquier objeto contenido en la figura. DATA puede ser cualquier cosa que una aplicación desee almacenar para más tarde recuperación.

DATA = guidata (H) devuelve los datos previamente almacenados, o un Matriz si no había nada previamente almacenado. Guidata proporciona a los autores de aplicaciones una interfaz conveniente A los datos de aplicación de una figura. Puede acceder a los datos La subfunción de devolución de llamada con el asa del componente, sin Para encontrar el mango de la figura. También puede evitar tener que crear Y mantener un nombre de propiedad codificado para los datos de la aplicación En todo el código fuente. Guidata es particularmente útil en Conjuntamente con GUIHANDLES, que devuelve una estructura que contiene Maneja de todos los componentes en una interfaz gráfica de usuario listada por etiqueta. isnan verdadero para no-a-número. Isnan (X) devuelve una matriz que contiene 1's donde los elementos de X son NaN y 0's donde no lo son. Por ejemplo, isnan ([pi NaN Inf-Inf]) es [0 1 0 0]. errordlg Error cuadro de diálogo. HANDLE = errordlg (ERRORSTRING, DLGNAME) crea un cuadro de diálogo de error que Muestra ERRORSTRING en una ventana denominada DLGNAME. Un botón con la etiqueta OK Debe presionarse para que desaparezca el cuadro de error. HANDLE = errordlg (ERRORSTRING, DLGNAME, CREATEMODE) permite CREATEMODE Opciones que son las mismas que las ofrecidas por MSGBOX. El valor predeterminado Para CREATEMODE es 'no modal'. ErrorString aceptará cualquier entrada de cadena válida pero una matriz de celda es privilegiado. Errordlg utiliza MSGBOX. Consulte la ayuda de MSGBOX para obtener Descripción de los argumentos de entrada a errordlg.

strcat Concatenar el texto. COMBINEDSTR = strcat (S1, S2, ..., SN) concatena horizontalmente el texto En las matrices S1, S2, ..., SN. Las entradas pueden ser combinaciones de caracteres Vectores, vectores de caracteres en células escalares, conjuntos de caracteres Mismo número de filas, matrices de celdas del mismo tamaño de vectores de caracteres, Cadenas escalares o conjuntos de cadenas del mismo tamaño. Si cualquier entrada es una cadena Matriz, COMBINEDSTR es una matriz de cadena. De lo contrario, si cualquier entrada es una celda Array, COMBINEDSTR es una matriz de celdas. De lo contrario, COMBINEDSTR es un Matriz de caracteres. eval Ejecutar expresión MATLAB en texto. Eval (EXPRESSION) evalúa el código MATLAB en el vector de caracteres EXPRESIÓN. [OUTPUT1, ..., OUTPUTN] = eval (EXPRESSION) devuelve la salida de EXPRESSION En las variables especificadas. Ejemplo: Solicitar interactivamente el nombre de una matriz para trazar. Expression = input ('Introduzca el nombre de una matriz:', 's'); If (existe (expresión, 'var')) Parcela (eval (expresión)) end Conclusión Es increíble la forma en que Matlab, nos soluciona tantas cosas, como estas, que deberían de ser montones de comandos en Java, pero Matlab, hace casi todo el trabajo por ti, ya solo te tienes que ocupar de que función deberá hacer botón, string, etc. Código function varargout = Calculadora_HD(varargin) % CALCULADORA_HD MATLAB code for Calculadora_HD.fig % CALCULADORA_HD, by itself, creates a new CALCULADORA_HD or raises the existing % singleton*. %

% H = CALCULADORA_HD returns the handle to a new CALCULADORA_HD or the handle to % the existing singleton*. % % CALCULADORA_HD('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in CALCULADORA_HD.M with the given input arguments. % % CALCULADORA_HD('Property','Value',...) creates a new CALCULADORA_HD or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before Calculadora_HD_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to Calculadora_HD_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 Calculadora_HD % Last Modified by GUIDE v2.5 12-May-2017 16:53:58 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @Calculadora_HD_OpeningFcn, ... 'gui_OutputFcn', @Calculadora_HD_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 Calculadora_HD is made visible. function Calculadora_HD_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 Calculadora_HD (see VARARGIN)

% Choose default command line output for Calculadora_HD handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes Calculadora_HD wait for user response (see UIRESUME) % uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line. function varargout = Calculadora_HD_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 siete. function siete_Callback(hObject, eventdata, handles) % hObject handle to siete (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text2,'String'); textString=strcat(textString,'7'); set(handles.text2,'String',textString) % --- Executes on button press in ocho. function ocho_Callback(hObject, eventdata, handles) % hObject handle to ocho (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text2,'String'); textString=strcat(textString,'8'); set(handles.text2,'String',textString) % --- Executes on button press in uno. function uno_Callback(hObject, eventdata, handles) % hObject handle to uno (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text2,'String'); textString=strcat(textString,'1'); set(handles.text2,'String',textString)

% --- Executes on button press in dos. function dos_Callback(hObject, eventdata, handles) % hObject handle to dos (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text2,'String'); textString=strcat(textString,'2'); set(handles.text2,'String',textString) % --- Executes on button press in igual. function igual_Callback(hObject, eventdata, handles) % hObject handle to igual (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text2,'String'); textString=eval(textString,'1'); set(handles.text2,'String',textString) % --- Executes on button press in tres. function tres_Callback(hObject, eventdata, handles) % hObject handle to tres (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text2,'String'); textString=strcat(textString,'3'); set(handles.text2,'String',textString) % --- Executes on button press in cero. function cero_Callback(hObject, eventdata, handles) % hObject handle to cero (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text2,'String'); textString=strcat(textString,'0'); set(handles.text2,'String',textString) % --- Executes on button press in div. function div_Callback(hObject, eventdata, handles) % hObject handle to div (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text2,'String'); textString=strcat(textString,'/'); set(handles.text2,'String',textString) % --- Executes on button press in sum. function sum_Callback(hObject, eventdata, handles) % hObject handle to sum (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text2,'String'); textString=strcat(textString,'+'); set(handles.text2,'String',textString) % --- Executes on button press in mult. function mult_Callback(hObject, eventdata, handles) % hObject handle to mult (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

textString=get(handles.text2,'String'); textString=strcat(textString,'*'); set(handles.text2,'String',textString) % --- Executes on button press in rest. function rest_Callback(hObject, eventdata, handles) % hObject handle to rest (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text2,'String'); textString=strcat(textString,'-'); set(handles.text2,'String',textString) % --- Executes on button press in seis. function seis_Callback(hObject, eventdata, handles) % hObject handle to seis (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text2,'String'); textString=strcat(textString,'6'); set(handles.text2,'String',textString) % --- Executes on button press in cinco. function cinco_Callback(hObject, eventdata, handles) % hObject handle to cinco (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text2,'String'); textString=strcat(textString,'5'); set(handles.text2,'String',textString) % --- Executes on button press in cuatro. function cuatro_Callback(hObject, eventdata, handles) % hObject handle to cuatro (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text2,'String'); textString=strcat(textString,'4'); set(handles.text2,'String',textString) % --- Executes on button press in nueve. function nueve_Callback(hObject, eventdata, handles) % hObject handle to nueve (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text2,'String'); textString=strcat(textString,'9'); set(handles.text2,'String',textString) % --- Executes on button press in ac. function ac_Callback(hObject, eventdata, handles) % hObject handle to ac (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) ini=char(' '); set(handles.text2,'String',ini)

% --- Executes on button press in acerca. function acerca_Callback(hObject, eventdata, handles) % hObject handle to acerca (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) msgbox('Calculadora super HD, pero sencilla. Por: Bravo Medrano Luis Enrique','Acercar del mejor')

Resultados...


Similar Free PDFs