0% found this document useful (0 votes)
69 views4 pages

'Gui - Name' 'Gui - Singleton' 'Gui - Openingfcn' 'Gui - Outputfcn' 'Gui - Layoutfcn' 'Gui - Callback'

This document contains the code for a GUI application in MATLAB. It defines functions for initializing the GUI, opening the GUI window and positioning it on the screen, outputting results, and handling button clicks to execute calculations, create a new instance, or close the application. The calculations involve setting up and solving a system of equations represented by matrices to determine forces on a truss structure.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views4 pages

'Gui - Name' 'Gui - Singleton' 'Gui - Openingfcn' 'Gui - Outputfcn' 'Gui - Layoutfcn' 'Gui - Callback'

This document contains the code for a GUI application in MATLAB. It defines functions for initializing the GUI, opening the GUI window and positioning it on the screen, outputting results, and handling button clicks to execute calculations, create a new instance, or close the application. The calculations involve setting up and solving a system of equations represented by matrices to determine forces on a truss structure.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

function varargout = ARMADURITA3(varargin)

gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @ARMADURITA3_OpeningFcn, ...
'gui_OutputFcn', @ARMADURITA3_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 ARMADURITA3 is made visible.


function ARMADURITA3_OpeningFcn(hObject, eventdata, handles, varargin)
scrsz=get(0,'screensize');
pa=get(gcf,'position');
xr=scrsz(3)-pa(3);
xp=round(xr/2);
yr=scrsz(4)-pa(4);
yp=round(yr/2);
set(gcf,'position',[xp yp pa(3) pa(4)]);
LOGO1=imread('ARMADURA8.jpg');
axes(handles.axes1);
imshow(LOGO1);
handles.output = hObject;
guidata(hObject, handles);

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


% uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.
function varargout = ARMADURITA3_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 EJECUTAR.


function EJECUTAR_Callback(hObject, eventdata, handles)
FX1=str2double(get(handles.fx1,'string'));
FX2=str2double(get(handles.fx2,'string'));
mtz=zeros(10);
mtz(1,7)=1;
mtz(1,8)=1;
mtz(2,9)=1;
mtz(3,2)=1;
mtz(6,3)=-1;
mtz(7,2)=-1;
mtz(8,3)=1;
mtz(8,5)=-1;
mtz(9,7)=-1;
mtz(10,5)=1;
mtz(10,10)=1;
mtz(1,6)=sqrt(3)/2;
mtz(2,6)=1/2;
mtz(3,1)=sqrt(2)/2;
mtz(3,4)=1/2;
mtz(3,6)=-sqrt(3)/2;
mtz(4,1)=sqrt(2)/2;
mtz(4,4)=-sqrt(3)/2;
mtz(4,6)=-1/2;
mtz(5,1)=-sqrt(2)/2;
mtz(6,1)=-sqrt(2)/2;
mtz(9,4)=-1/2;
mtz(10,4)=sqrt(3)/2;

%matriz columna
B=zeros(10,1);
B(5,1)=-FX1;
B(7,1)=-FX2;

%matriz de coeficientes
[m n]=size(mtz);
celda=cell(n,n);
celda(:,:)={''};
set(handles.uitable1,'Data',celda);
set(handles.uitable1,'ColumnEditable',true(1,n));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set(handles.uitable1,'Data',mtz);
set(handles.uitable1,'visible','on')

%matriz de resultados
[m n]=size(mtz);
celda=cell(n,n);
celda(:,:)={''};
set(handles.uitable2,'Data',celda);
set(handles.uitable2,'ColumnEditable',true(1,n));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set(handles.uitable2,'Data',B);
set(handles.uitable2,'visible','on')

%solucion del sistema de ecuaciones


respuesta=mtz\B;
%matriz final
[m n]=size(mtz);
celda=cell(n,n);
celda(:,:)={''};
set(handles.uitable3,'Data',celda);
set(handles.uitable3,'ColumnEditable',true(1,n));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
set(handles.uitable3,'Data',respuesta);
set(handles.uitable3,'visible','on');

function NUEVO_Callback(hObject, eventdata, handles)


% hObject handle to NUEVO (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% --- Executes on button press in SALIR.


function SALIR_Callback(hObject, eventdata, handles)
Close(ARMADURITA3)

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


function axes1_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns
called

% Hint: place code in OpeningFcn to populate axes1

function fx1_Callback(hObject, eventdata, handles)


% hObject handle to fx1 (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 fx1 as text


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

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


function fx1_CreateFcn(hObject, eventdata, handles)
% hObject handle to fx1 (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 fx2_Callback(hObject, eventdata, handles)
% hObject handle to fx2 (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 fx2 as text


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

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


function fx2_CreateFcn(hObject, eventdata, handles)
% hObject handle to fx2 (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

You might also like