Calculadora de Matrices en Matlab

Descargar como docx, pdf o txt
Descargar como docx, pdf o txt
Está en la página 1de 42

lógica de programación

Matrix Operations
Jonnier Andres Vega Herrera
Andres Felipe Cerón Calderón
[email protected]
[email protected]
Universidad Santo Tomás

Resumen

M. O. Es una Aplicación de Matrices ideal para desarrollar operaciones de matrices, para


métodos y operaciones que requiere cálculos complicados. Tiene la facilidad de resolver
las operaciones de matrices de manera eficiente de la misma manera que una persona lo
haría.

La característica clave de la aplicación de matrices es la habilidad de usar números


complejos en cualquier método, También tenemos mecanismos de cálculos continuos.
Esto significa que después de usar un método, puede continuar calculando y utilizando
algún otro método con la matriz original o con el resultado.

Objetivo General

● Generar una estrategia que facilite el cálculo numérico y permita la resolución de


operaciones matriciales.
● Elaborar una calculadora de operaciones básicas entre dos matrices empleando la
suma, resta y multiplicación, para poner en práctica los conocimientos previos
sobre arreglos de matrices.

1
lógica de programación

Objetivos Específicos

● Identificar los conocimientos adquiridos en lógica de programación para el diseño


operacional de la calculadora de matrices de la calculadora matricial
● Aplicar conocimientos algebraicos para las operaciones matriciales
● Crear una calculadora que permita calcular operaciones matriciales

Problema

En la actualidad las operaciones algebraicas son un tema de interés general, tanto para los
estudiantes, como diferentes disciplinas, ingenierías, ciencias humanas e incluso
administración por ende se necesita crear una herramienta que facilite las operaciones
matriciales. ¿Es posible la creación de herramientas que operen matrices?; ¿Qué
estrategia se puede crear para operaciones matriciales?

Marco Teórico

Si, ya existen aplicaciones o herramientas para operar matrices, donde hay que crear una
aplicación que pueda satisfacer las necesidades de los usuarios utilizando los diferentes
métodos de solución de matrices. En la aplicación estará disponibles las siguientes
operaciones:

2
lógica de programación

Simulación

Por motivos de no contar con el conocimiento suficiente y práctica necesaria para poder
realizar la misma, no tenemos una simulación estructurada.

Cálculos Teóricos

● Suma
● Resta
● Multiplicación
● División
● Suma y multiplicación de exponente
● Suma y multiplicación de raíces

Alcance

El programa se ejecutará bajo algunos límites:

● se tendrá en cuenta que el tamaño máximo de una matriz será 3 x 3

3
lógica de programación

● se trabajará: suma, resta y multiplicación de matrices.

Algoritmo

1. inicio
2. definir las variables una para el tamaño de la matriz, 6 variables para
operaciones matriciales y una de salida
3. leer las variables
4. definir operación matricial
5. elegir el tamaño de la matriz
6. Digitar los números en la matriz
7. Ejecutar la operación matricial
8. Resultado
9. Fin

4
lógica de programación

Código en matlab

function varargout = calculadoraM2021(varargin)

% CALCULADORAM2021 MATLAB code for calculadoraM2021.fig

% CALCULADORAM2021, by itself, creates a new CALCULADORAM2021


or raises the existing

% singleton*.

% H = CALCULADORAM2021 returns the handle to a new


CALCULADORAM2021 or the handle to

% the existing singleton*.

% CALCULADORAM2021('CALLBACK',hObject,eventData,handles,...)
calls the local

% function named CALLBACK in CALCULADORAM2021.M with the given


input arguments.

% CALCULADORAM2021('Property','Value',...) creates a new


CALCULADORAM2021 or raises the

% existing singleton*. Starting from the left, property value pairs are

% applied to the GUI before calculadoraM2021_OpeningFcn gets called. An

% unrecognized property name or invalid value makes property application

% stop. All inputs are passed to calculadoraM2021_OpeningFcn via varargin.


5
lógica de programación

% *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 calculadoraM2021

% Last Modified by GUIDE v2.5 31-Oct-2021 20:10:50

% Begin initialization code - DO NOT EDIT

gui_Singleton = 1;

gui_State = struct('gui_Name', mfilename, ...

'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @calculadoraM2021_OpeningFcn, ...

'gui_OutputFcn', @calculadoraM2021_OutputFcn, ...

'gui_LayoutFcn', [] , ...

'gui_Callback', []);

if nargin && ischar(varargin{1})

gui_State.gui_Callback = str2func(varargin{1});

end

6
lógica de programación

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 calculadoraM2021 is made visible.

function calculadoraM2021_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 calculadoraM2021 (see VARARGIN)

% Choose default command line output for calculadoraM2021

handles.output = hObject;

% Update handles structure

guidata(hObject, handles);

7
lógica de programación

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

% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.

function varargout = calculadoraM2021_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;

function C11_Callback(hObject, eventdata, handles)

% hObject handle to C11 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of C11 as text

8
lógica de programación

% str2double(get(hObject,'String')) returns contents of C11 as a double

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

function C11_CreateFcn(hObject, eventdata, handles)

% hObject handle to C11 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

function C12_Callback(hObject, eventdata, handles)

% hObject handle to C12 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

9
lógica de programación

% Hints: get(hObject,'String') returns contents of C12 as text

% str2double(get(hObject,'String')) returns contents of C12 as a double

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

function C12_CreateFcn(hObject, eventdata, handles)

% hObject handle to C12 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

function C13_Callback(hObject, eventdata, handles)

% hObject handle to C13 (see GCBO)

10
lógica de programación

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of C13 as text

% str2double(get(hObject,'String')) returns contents of C13 as a double

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

function C13_CreateFcn(hObject, eventdata, handles)

% hObject handle to C13 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

11
lógica de programación

function C21_Callback(hObject, eventdata, handles)

% hObject handle to C21 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of C21 as text

% str2double(get(hObject,'String')) returns contents of C21 as a double

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

function C21_CreateFcn(hObject, eventdata, handles)

% hObject handle to C21 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

12
lógica de programación

function C22_Callback(hObject, eventdata, handles)

% hObject handle to C22 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of C22 as text

% str2double(get(hObject,'String')) returns contents of C22 as a double

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

function C22_CreateFcn(hObject, eventdata, handles)

% hObject handle to C22 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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');

13
lógica de programación

end

function C23_Callback(hObject, eventdata, handles)

% hObject handle to C23 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of C23 as text

% str2double(get(hObject,'String')) returns contents of C23 as a double

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

function C23_CreateFcn(hObject, eventdata, handles)

% hObject handle to C23 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.

% See ISPC and COMPUTER.

14
lógica de programación

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white');

end

function C31_Callback(hObject, eventdata, handles)

% hObject handle to C31 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of C31 as text

% str2double(get(hObject,'String')) returns contents of C31 as a double

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

function C31_CreateFcn(hObject, eventdata, handles)

% hObject handle to C31 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

15
lógica de programación

% Hint: edit 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

function C32_Callback(hObject, eventdata, handles)

% hObject handle to C32 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of C32 as text

% str2double(get(hObject,'String')) returns contents of C32 as a double

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

function C32_CreateFcn(hObject, eventdata, handles)

% hObject handle to C32 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

16
lógica de programación

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

function C33_Callback(hObject, eventdata, handles)

% hObject handle to C33 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of C33 as text

% str2double(get(hObject,'String')) returns contents of C33 as a double

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

function C33_CreateFcn(hObject, eventdata, handles)

17
lógica de programación

% hObject handle to C33 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

function B11_Callback(hObject, eventdata, handles)

% hObject handle to B11 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of B11 as text

% str2double(get(hObject,'String')) returns contents of B11 as a double

global B;

B(1,1)=str2double(get(hObject,'String'));

18
lógica de programación

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

function B11_CreateFcn(hObject, eventdata, handles)

% hObject handle to B11 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

function B12_Callback(hObject, eventdata, handles)

% hObject handle to B12 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of B12 as text

19
lógica de programación

% str2double(get(hObject,'String')) returns contents of B12 as a double

global B;

B(1,2)=str2double(get(hObject,'String'));

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

function B12_CreateFcn(hObject, eventdata, handles)

% hObject handle to B12 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

function B13_Callback(hObject, eventdata, handles)

% hObject handle to B13 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

20
lógica de programación

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of B13 as text

% str2double(get(hObject,'String')) returns contents of B13 as a double

global B;

B(1,3)=str2double(get(hObject,'String'));

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

function B13_CreateFcn(hObject, eventdata, handles)

% hObject handle to B13 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

21
lógica de programación

function B21_Callback(hObject, eventdata, handles)

% hObject handle to B21 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of B21 as text

% str2double(get(hObject,'String')) returns contents of B21 as a double

global B;

B(2,1)=str2double(get(hObject,'String'));

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

function B21_CreateFcn(hObject, eventdata, handles)

% hObject handle to B21 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

22
lógica de programación

function B22_Callback(hObject, eventdata, handles)

% hObject handle to B22 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of B22 as text

% str2double(get(hObject,'String')) returns contents of B22 as a double

global B;

B(2,2)=str2double(get(hObject,'String'));

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

function B22_CreateFcn(hObject, eventdata, handles)

% hObject handle to B22 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.

% See ISPC and COMPUTER.

23
lógica de programación

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white');

end

function B23_Callback(hObject, eventdata, handles)

% hObject handle to B23 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of B23 as text

% str2double(get(hObject,'String')) returns contents of B23 as a double

global B;

B(2,3)=str2double(get(hObject,'String'));

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

function B23_CreateFcn(hObject, eventdata, handles)

% hObject handle to B23 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

24
lógica de programación

% Hint: edit 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

function B31_Callback(hObject, eventdata, handles)

% hObject handle to B31 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of B31 as text

% str2double(get(hObject,'String')) returns contents of B31 as a double

global B;

B(3,1)=str2double(get(hObject,'String'));

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

function B31_CreateFcn(hObject, eventdata, handles)

25
lógica de programación

% hObject handle to B31 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

function B32_Callback(hObject, eventdata, handles)

% hObject handle to B32 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of B32 as text

% str2double(get(hObject,'String')) returns contents of B32 as a double

global B;

B(3,2)=str2double(get(hObject,'String'));

26
lógica de programación

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

function B32_CreateFcn(hObject, eventdata, handles)

% hObject handle to B32 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

function B33_Callback(hObject, eventdata, handles)

% hObject handle to B33 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of B33 as text

27
lógica de programación

% str2double(get(hObject,'String')) returns contents of B33 as a double

global B;

B(3,3)=str2double(get(hObject,'String'));

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

function B33_CreateFcn(hObject, eventdata, handles)

% hObject handle to B33 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

function A11_Callback(hObject, eventdata, handles)

% hObject handle to A11 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

28
lógica de programación

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of A11 as text

global A;

A(1,1)=str2double(get(hObject,'String'));

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

function A11_CreateFcn(hObject, eventdata, handles)

% hObject handle to A11 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

29
lógica de programación

function A12_Callback(hObject, eventdata, handles)

% hObject handle to A12 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of A12 as text

global A;

A(1,2)=str2double(get(hObject,'String'));

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

function A12_CreateFcn(hObject, eventdata, handles)

% hObject handle to A12 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

30
lógica de programación

function A13_Callback(hObject, eventdata, handles)

% hObject handle to A13 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of A13 as text

global A;

A(1,3)=str2double(get(hObject,'String'));

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

function A13_CreateFcn(hObject, eventdata, handles)

% hObject handle to A13 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.

% See ISPC and COMPUTER.

31
lógica de programación

if ispc && isequal(get(hObject,'BackgroundColor'),


get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white');

end

function A21_Callback(hObject, eventdata, handles)

% hObject handle to A21 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of A21 as text

global A;

A(2,1)=str2double(get(hObject,'String'));

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

function A21_CreateFcn(hObject, eventdata, handles)

% hObject handle to A21 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

32
lógica de programación

% Hint: edit 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

function A22_Callback(hObject, eventdata, handles)

% hObject handle to A22 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of A22 as text

global A;

A(2,2)=str2double(get(hObject,'String'));

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

function A22_CreateFcn(hObject, eventdata, handles)

33
lógica de programación

% hObject handle to A22 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

function A23_Callback(hObject, eventdata, handles)

% hObject handle to A23 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of A23 as text

global A;

A(2,3)=str2double(get(hObject,'String'));

34
lógica de programación

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

function A23_CreateFcn(hObject, eventdata, handles)

% hObject handle to A23 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

function A31_Callback(hObject, eventdata, handles)

% hObject handle to A31 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of A31 as text

35
lógica de programación

global A;

A(3,1)=str2double(get(hObject,'String'));

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

function A31_CreateFcn(hObject, eventdata, handles)

% hObject handle to A31 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

function A32_Callback(hObject, eventdata, handles)

% hObject handle to A32 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

36
lógica de programación

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of A32 as text

global A;

A(3,2)=str2double(get(hObject,'String'));

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

function A32_CreateFcn(hObject, eventdata, handles)

% hObject handle to A32 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

37
lógica de programación

function A33_Callback(hObject, eventdata, handles)

% hObject handle to A33 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of A33 as text

global A;

A(3,3)=str2double(get(hObject,'String'));

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

function A33_CreateFcn(hObject, eventdata, handles)

% hObject handle to A33 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit 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

38
lógica de programación

% --- Executes on button press in SUMA.

function SUMA_Callback(hObject, eventdata, handles)

% hObject handle to SUMA (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

global A;

global B;

global C;

C=A+B;

set(handles.C11,'string',C(1,1));

set(handles.C12,'string',C(1,2));

set(handles.C13,'string',C(1,3));

set(handles.C21,'string',C(2,1));

set(handles.C22,'string',C(2,2));

set(handles.C23,'string',C(2,3));

set(handles.C31,'string',C(3,1));

set(handles.C32,'string',C(3,2));

set(handles.C33,'string',C(3,3));

% --- Executes on button press in RESTA.

39
lógica de programación

function RESTA_Callback(hObject, eventdata, handles)

% hObject handle to RESTA (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

global A;

global B;

global C;

C=A-B;

set(handles.C11,'string',C(1,1));

set(handles.C12,'string',C(1,2));

set(handles.C13,'string',C(1,3));

set(handles.C21,'string',C(2,1));

set(handles.C22,'string',C(2,2));

set(handles.C23,'string',C(2,3));

set(handles.C31,'string',C(3,1));

set(handles.C32,'string',C(3,2));

set(handles.C33,'string',C(3,3));

% --- Executes on button press in MULTIPLICACION.

function MULTIPLICACION_Callback(hObject, eventdata, handles)

% hObject handle to MULTIPLICACION (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

40
lógica de programación

% handles structure with handles and user data (see GUIDATA)

global A;

global B;

global C;

C=A*B;

set(handles.C11,'string',C(1,1));

set(handles.C12,'string',C(1,2));

set(handles.C13,'string',C(1,3));

set(handles.C21,'string',C(2,1));

set(handles.C22,'string',C(2,2));

set(handles.C23,'string',C(2,3));

set(handles.C31,'string',C(3,1));

set(handles.C32,'string',C(3,2));

set(handles.C33,'string',C(3,3));

% --- Executes on button press in DET.

function DET_Callback(hObject, eventdata, handles)

% hObject handle to DET (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles

and user data (see GUIDATA)

41
lógica de programación

% --- Executes on button press in INVERSA.

function INVERSA_Callback(hObject, eventdata, handles)

% hObject handle to INVERSA (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

42

También podría gustarte