You are on page 1of 45

Stiffness 2D

Program Discerption:
A standalone program “Stiffness 2D” was created using the MATLAB compiler. The program is formed from more than
2500 execution code lines written in MATLAB compiler programming language. It can be used to solve any 2D frame
structure using the generalized stiffness method. Solution includes deformations at nodes, members end forces, and
stiffness matrices, load vectors & displacement vectors generated after each execution step.

The program is limited to some features:

- Stiffness matrix is formed with neglecting shear deformations.


- Only specific type of loading can be applied on members (with maximum 2 sets of loading) applied to the
local axes of members.
- Only restrains for supports are applicable (no elastic springs could be assigned to nodes).
- Cross section properties (area, & inertia) should be given as input (not self-calculated).
- Do not consider the own weight of the member.
- The program does not recognize units, so user should use consistent units.

Some advanced features the program presents:

- No limitation on the number of members.


- End releases could be assigned to members ends.
- Input for nodes & members could be either through the program interface or importing data from text files.
- Exporting nodes & members data to text files.
- Condensation of degrees of freedoms is applicable, though out the arranging of degrees of freedom then
condensing the stiffness matrix & load vector.
- The program need only MATLAB compiler runtime for execution which is available online from Simulink-
MathWorks for free.
- Fast computation time & small disk space required.

Program interface
Nodal data.

Node coordinates.

Node Supports.

Nodal forces.

Move node row data up or down.

Export node data to text file.

Directory of input text file used. Browse for input text file.
Members data.

Member nodal
connectivity.

Member section
properties

Member loading
set (1).

Member loading Export member data to text file.


set (1).

Directory of input text file used. Browse for input text file.

Different applicable loading types that


could be assigned to members definitions.
Directory of output text file used.

Execution commands.
Input file format
I) Nodes input file
Node ID Node Force
(Must be numeric) Y-Coordinate Y-Restraint (In X-Direction) Node Moment

X-Coordinate X-Restraint Ѳ-Restraint Node Force


(In Y-Direction)

- Units must be consistent


- Restraints (0: Restrained, 1: Allowed, 0.5: Allowed but will be removed by condensation).
- Positive moment direction is counterclockwise.
II) Members input file
Member ID
(Must be numeric) End-Node ID E Area Inertia Loading Set (1) Loading Set (2)

Start-Node ID End Releases

- Units must be consistent


- End release (0: No releases, 1: release @ start node, 2: release @ end node, 3: release @ start & end nodes).
- Loading set 1st column: load type index (0: none, 1 to 7: load types from 1 to 7).
- Loading set 2nd column: load value (w or P).
- Loading set 3rd column: distance “a” if required, otherwise 0.
Verification Problem
I) Verification criteria:
A 2D frame is analyzed using SAP2000 program, then the results (members end forces & joint deformations) are
compared to the results obtained from the MATLAB code.

II) Problem Discerption:

All columns are square of dimensions: 60x60 cm


All beams are square of dimensions: 80x80 cm
All members of same material with E = 25000000 kN/m2

Nodes & Members Labels.


III) Results comparison:
a. Node Results:

Node DOFGlobal SAP2000 Stiffness 2D %


Ux mm 0.000 0.000 100.0%
1 Uy mm 0.000 0.000 100.0%
Ѳ rad *10-5 0.000 0.000 100.0%
Ux mm 0.000 0.000 100.0%
2 Uy mm 0.000 0.000 100.0%
Ѳ rad *10-5 0.000 0.000 100.0%
Ux mm 0.000 0.000 100.0%
3 Uy mm 0.000 0.000 100.0%
Ѳ rad *10-5 -9.200 -9.190 99.9%
Ux mm 0.000 0.000 100.0%
4 Uy mm 0.000 0.000 100.0%
Ѳ rad *10-5 0.000 0.000 100.0%
Ux mm 0.351 0.351 100.1%
5 Uy mm -0.018 -0.018 102.2%
Ѳ rad *10-5 -1.200 -1.213 101.1%
Ux mm 0.353 0.353 100.0%
6 Uy mm -0.023 -0.023 100.5%
Ѳ rad *10-5 -2.800 -2.776 99.1%
Ux mm 0.354 0.354 99.9%
7 Uy mm -0.019 -0.019 101.7%
Ѳ rad *10-5 0.690 0.690 100.0%
Ux mm 0.355 0.355 100.1%
8 Uy mm -0.036 -0.036 101.4%
Ѳ rad *10-5 -1.300 -1.286 98.9%
Ux mm 1.543 1.543 100.0%
9 Uy mm -0.037 -0.037 99.0%
Ѳ rad *10-5 -9.500 -9.454 99.5%
Ux mm 1.534 1.534 100.0%
10 Uy mm -1.205 -1.205 100.0%
Ѳ rad *10-5 2.900 2.858 98.6%
Ux mm 1.532 1.532 100.0%
11 Uy mm -0.067 -0.067 99.9%
Ѳ rad *10-5 22.300 22.275 99.9%
Ux mm 0.594 0.594 100.0%
12 Uy mm -1.205 -1.205 100.0%
Ѳ rad *10-5 20.100 20.127 100.1%
Ux mm 0.593 0.593 100.0%
13 Uy mm -0.068 -0.068 99.4%
Ѳ rad *10-5 17.400 17.373 99.8%
b. Members Results:

SAP2000 Stiffness 2D Ratio


Frame Station P V3 M2 P V3 M2 P V3 M2
KN KN KN-m KN KN KN-m % % %
Start 27.607 4.726 14.723 27.607 4.726 14.723 100.0% 100.0% 100.0%
1
End 27.607 4.726 13.631 27.607 4.726 13.631 100.0% 100.0% 100.0%
Start 34.674 4.044 13.380 34.674 4.044 13.380 100.0% 100.0% 100.0%
2
End 34.674 4.044 10.882 34.674 4.044 10.882 100.0% 100.0% 100.0%
Start 28.985 1.482 0.000 28.985 1.482 0.000 100.0% 100.0% 100.0%
3
End 28.985 1.482 8.891 28.985 1.482 8.891 100.0% 100.0% 100.0%
Start 54.734 4.749 14.825 54.734 4.749 14.825 100.0% 100.0% 100.0%
4
End 54.734 4.749 13.668 54.734 4.749 13.668 100.0% 100.0% 100.0%
Start 4.726 0.270 13.631 4.726 0.270 13.631 100.0% 100.0% 100.0%
5
End 4.726 17.730 38.750 4.726 17.730 38.750 100.0% 100.0% 100.0%
Start 3.195 9.960 8.016 3.195 9.960 8.016 100.0% 100.0% 100.0%
6
End 3.195 20.040 22.227 3.195 20.040 22.226 100.0% 100.0% 100.0%
Start 4.676 8.945 13.335 4.676 8.945 13.335 100.0% 100.0% 100.0%
7
End 4.676 9.055 13.668 4.676 9.055 13.668 100.0% 100.0% 100.0%
Start 27.337 0.000 0.000 27.337 0.000 0.000 100.0% 100.0% 100.0%
8
End 27.337 0.000 0.000 27.337 0.000 0.000 100.0% 100.0% 100.0%
Start 0.997 8.881 35.884 0.997 8.881 35.884 100.0% 100.0% 100.0%
9
End 0.997 8.881 39.470 0.997 8.881 39.470 100.0% 100.0% 100.0%
Start 45.678 9.425 0.000 45.678 9.425 0.000 100.0% 100.0% 100.0%
10
End 45.678 9.425 56.552 45.678 9.425 56.552 100.0% 100.0% 100.0%
Start 15.000 7.337 30.000 15.000 7.337 30.000 100.0% 100.0% 100.0%
11
End 15.000 7.337 58.048 15.000 7.337 58.048 100.0% 100.0% 100.0%
Start 5.672 15.249 78.486 5.672 15.249 78.486 100.0% 100.0% 100.0%
12
End 5.672 44.751 70.018 5.672 44.751 70.018 100.0% 100.0% 100.0%
Start 0.928 3.754 19.032 0.928 3.754 19.032 99.9% 100.0% 100.0%
13
End 0.928 3.754 3.490 0.928 3.754 3.490 99.9% 100.0% 100.0%
Start 0.928 3.754 13.466 0.928 3.754 13.466 99.9% 100.0% 100.0%
14
End 0.928 3.754 9.055 0.928 3.754 9.055 99.9% 100.0% 100.0%
Start 3.754 0.928 3.490 3.754 0.928 3.490 100.0% 99.9% 100.0%
15
End 3.754 0.928 9.055 3.754 0.928 9.055 100.0% 99.9% 100.0%
MATLAB Code
classdef Stiffness2D_V3 < matlab.apps.AppBase

% Properties that correspond to app components


properties (Access = public)
Stiffness2DUIFigure matlab.ui.Figure
TabGroup matlab.ui.container.TabGroup
NodesTab matlab.ui.container.Tab
Button_Export matlab.ui.control.Button
Panel_3 matlab.ui.container.Panel
Button_Down matlab.ui.control.Button
Button_Up matlab.ui.control.Button
Panel_2 matlab.ui.container.Panel
Field_FileName matlab.ui.control.EditField
BrowseButton matlab.ui.control.Button
FromFileLabel matlab.ui.control.Label
Panel matlab.ui.container.Panel
DeleteNodeButton matlab.ui.control.Button
ModifyNodeButton matlab.ui.control.Button
AddNodeButton matlab.ui.control.Button
Drop_Node_R matlab.ui.control.DropDown
Drop_Node_Uy matlab.ui.control.DropDown
Drop_Node_Ux matlab.ui.control.DropDown
XLabel matlab.ui.control.Label
YLabel matlab.ui.control.Label
UxLabel matlab.ui.control.Label
UyLabel matlab.ui.control.Label
Label matlab.ui.control.Label
FyLabel matlab.ui.control.Label
MLabel matlab.ui.control.Label
FxLabel matlab.ui.control.Label
Field_Node_M matlab.ui.control.NumericEditField
Field_Node_Fx matlab.ui.control.NumericEditField
Field_Node_Fy matlab.ui.control.NumericEditField
Field_Node_Y matlab.ui.control.NumericEditField
Field_Node_X matlab.ui.control.NumericEditField
Table_Node matlab.ui.control.Table
MembersTab matlab.ui.container.Tab
Button_Export_2 matlab.ui.control.Button
DeleteMemberButton matlab.ui.control.Button
ModifyMemberButton matlab.ui.control.Button
AddMemberButton matlab.ui.control.Button
Panel_5 matlab.ui.container.Panel
Field_FileName_2 matlab.ui.control.EditField
BrowseButton_2 matlab.ui.control.Button
FromFileLabel_2 matlab.ui.control.Label
Panel_4 matlab.ui.container.Panel
Drop_Release matlab.ui.control.DropDown
ReleasesLabel matlab.ui.control.Label
aLabel_2 matlab.ui.control.Label
Field_Loada2 matlab.ui.control.NumericEditField
Drop_LoadType2 matlab.ui.control.DropDown
Load2Label matlab.ui.control.Label
ValueLabel_2 matlab.ui.control.Label
Field_LoadValue2 matlab.ui.control.NumericEditField
aLabel matlab.ui.control.Label
Field_Loada1 matlab.ui.control.NumericEditField
Field_A matlab.ui.control.NumericEditField
Field_E matlab.ui.control.NumericEditField
Drop_LoadType1 matlab.ui.control.DropDown
Drop_Nodej matlab.ui.control.DropDown
Drop_Nodei matlab.ui.control.DropDown
NodeiLabel matlab.ui.control.Label
NodejLabel matlab.ui.control.Label
ELabel matlab.ui.control.Label
ALabel matlab.ui.control.Label
Load1Label matlab.ui.control.Label
ValueLabel matlab.ui.control.Label
IxLabel matlab.ui.control.Label
Field_LoadValue1 matlab.ui.control.NumericEditField
Field_Ix matlab.ui.control.NumericEditField
Table_Members matlab.ui.control.Table
LoadTypesTab matlab.ui.container.Tab
Image matlab.ui.control.Image
CalculateTab matlab.ui.container.Tab
SolveMembersButton matlab.ui.control.Button
Panel_6 matlab.ui.container.Panel
Field_FileDirectory matlab.ui.control.EditField
DirectoryLabel matlab.ui.control.Label
SolveDOFButton matlab.ui.control.Button
CondenseButton matlab.ui.control.Button
ArrangeButton matlab.ui.control.Button
EleminateButton matlab.ui.control.Button
AssembleButton matlab.ui.control.Button
end

properties (Access = public)


nRNode;
Node;
indices;
NameNode;

nRMember;
Member;
indices2;
NameMember;

selpath;

PjGl;
MemTr;
MemStLo;
MemStGl;
PmLo;
PmGl;
PfGl;
StGl;
PGl;

nDofT;
nDofE;
nDofC;
DofT;
DofC;
PEl;
StEl;

StAr;
PAr;

StCon;
PCon;

StCC;
StCE;
StEC;
StEE;
PCC;
PEE;

UCC;
UEE;
UAr;
UEl;
UT;

UmGl;
UmLo;
MEF;
end

methods (Access = public)

function [PjGl,MemTr,MemStLo,MemStGl,PmLo,PmGl,PfGl,StGl,PGl] = StiffnessTotal(app,nRNode,Node,nRMember,Member)


%#ok<*INUSL>
PjGl = [];
MemTr = [];
MemStLo = [];
MemStGl_1 = [];
MemStGl = [];
PmLo = [];
PmGl = [];
PfGl = [];
StGl = [];
PGl = [];

for i = 1:nRMember
for j = 1:6
for k = 1:6
MemTr(i,j,k) = 0;
MemStLo(i,j,k) = 0;
MemStGl_1(i,j,k) = 0;
MemStGl(i,j,k) = 0;
end
PmLo(i,j) = 0;
PmGl(i,j) = 0;
end
end

for i = 1:3*nRNode
for j = 1:3*nRNode
StGl(i,j) = 0;
end
PjGl(i) = 0;
PfGl(i) = 0;
PGl(i) = 0;
end

for i = 1:nRNode
PjGl(3 * i - 2) = Node(i,7);
PjGl(3 * i - 1) = Node(i,8);
PjGl(3 * i) = Node(i,9);
end

for i = 1:nRMember
for j = 1:nRNode
if Member(i,2) == Node(j,1)
X1 = Node(j,2);
Y1 = Node(j,3);
NStart = 3*(j-1);
end
if Member(i,3) == Node(j,1)
X2 = Node(j,2);
Y2 = Node(j,3);
NEnd = 3*(j-1);
end
end
E = Member(i,4);
A = Member(i,5);
I = Member(i,6);
L = sqrt((X2-X1)^2+(Y2-Y1)^2);
S = (Y2-Y1)/L;
C = (X2-X1)/L;
Release = Member(i,13);

if Release == 0
MemStLo(i,1,1) = E*A/L; %#ok<*AGROW>
MemStLo(i,1,2) = 0;
MemStLo(i,1,3) = 0;
MemStLo(i,1,4) = -E*A/L;
MemStLo(i,1,5) = 0;
MemStLo(i,1,6) = 0;

MemStLo(i,2,1) = 0;
MemStLo(i,2,2) = 12*E*I/L^3;
MemStLo(i,2,3) = 6*E*I/L^2;
MemStLo(i,2,4) = 0;
MemStLo(i,2,5) = -12*E*I/L^3;
MemStLo(i,2,6) = 6*E*I/L^2;

MemStLo(i,3,1) = 0;
MemStLo(i,3,2) = 6*E*I/L^2;
MemStLo(i,3,3) = 4*E*I/L;
MemStLo(i,3,4) = 0;
MemStLo(i,3,5) = -6*E*I/L^2;
MemStLo(i,3,6) = 2*E*I/L;

MemStLo(i,4,1) = -E*A/L;
MemStLo(i,4,2) = 0;
MemStLo(i,4,3) = 0;
MemStLo(i,4,4) = E*A/L;
MemStLo(i,4,5) = 0;
MemStLo(i,4,6) = 0;

MemStLo(i,5,1) = 0;
MemStLo(i,5,2) = -12*E*I/L^3;
MemStLo(i,5,3) = -6*E*I/L^2;
MemStLo(i,5,4) = 0;
MemStLo(i,5,5) = 12*E*I/L^3;
MemStLo(i,5,6) = -6*E*I/L^2;

MemStLo(i,6,1) = 0;
MemStLo(i,6,2) = 6*E*I/L^2;
MemStLo(i,6,3) = 2*E*I/L;
MemStLo(i,6,4) = 0;
MemStLo(i,6,5) = -6*E*I/L^2;
MemStLo(i,6,6) = 4*E*I/L;

elseif Release == 1
MemStLo(i,1,1) = E*A/L; %#ok<*AGROW>
MemStLo(i,1,2) = 0;
MemStLo(i,1,3) = 0;
MemStLo(i,1,4) = -E*A/L;
MemStLo(i,1,5) = 0;
MemStLo(i,1,6) = 0;

MemStLo(i,2,1) = 0;
MemStLo(i,2,2) = 3*E*I/L^3;
MemStLo(i,2,3) = 0;
MemStLo(i,2,4) = 0;
MemStLo(i,2,5) = -3*E*I/L^3;
MemStLo(i,2,6) = 3*E*I/L^2;

MemStLo(i,3,1) = 0;
MemStLo(i,3,2) = 0;
MemStLo(i,3,3) = 0;
MemStLo(i,3,4) = 0;
MemStLo(i,3,5) = 0;
MemStLo(i,3,6) = 0;

MemStLo(i,4,1) = -E*A/L;
MemStLo(i,4,2) = 0;
MemStLo(i,4,3) = 0;
MemStLo(i,4,4) = E*A/L;
MemStLo(i,4,5) = 0;
MemStLo(i,4,6) = 0;
MemStLo(i,5,1) = 0;
MemStLo(i,5,2) = -3*E*I/L^3;
MemStLo(i,5,3) = 0;
MemStLo(i,5,4) = 0;
MemStLo(i,5,5) = 3*E*I/L^3;
MemStLo(i,5,6) = -3*E*I/L^2;

MemStLo(i,6,1) = 0;
MemStLo(i,6,2) = 3*E*I/L^2;
MemStLo(i,6,3) = 0;
MemStLo(i,6,4) = 0;
MemStLo(i,6,5) = -3*E*I/L^2;
MemStLo(i,6,6) = 3*E*I/L;
elseif Release == 2
MemStLo(i,1,1) = E*A/L; %#ok<*AGROW>
MemStLo(i,1,2) = 0;
MemStLo(i,1,3) = 0;
MemStLo(i,1,4) = -E*A/L;
MemStLo(i,1,5) = 0;
MemStLo(i,1,6) = 0;

MemStLo(i,2,1) = 0;
MemStLo(i,2,2) = 3*E*I/L^3;
MemStLo(i,2,3) = 3*E*I/L^2;
MemStLo(i,2,4) = 0;
MemStLo(i,2,5) = -3*E*I/L^3;
MemStLo(i,2,6) = 0;

MemStLo(i,3,1) = 0;
MemStLo(i,3,2) = 3*E*I/L^2;
MemStLo(i,3,3) = 3*E*I/L;
MemStLo(i,3,4) = 0;
MemStLo(i,3,5) = -3*E*I/L^2;
MemStLo(i,3,6) = 0;

MemStLo(i,4,1) = -E*A/L;
MemStLo(i,4,2) = 0;
MemStLo(i,4,3) = 0;
MemStLo(i,4,4) = E*A/L;
MemStLo(i,4,5) = 0;
MemStLo(i,4,6) = 0;

MemStLo(i,5,1) = 0;
MemStLo(i,5,2) = -3*E*I/L^3;
MemStLo(i,5,3) = -3*E*I/L^2;
MemStLo(i,5,4) = 0;
MemStLo(i,5,5) = 3*E*I/L^3;
MemStLo(i,5,6) = 0;

MemStLo(i,6,1) = 0;
MemStLo(i,6,2) = 0;
MemStLo(i,6,3) = 0;
MemStLo(i,6,4) = 0;
MemStLo(i,6,5) = 0;
MemStLo(i,6,6) = 0;
else
MemStLo(i,1,1) = E*A/L; %#ok<*AGROW>
MemStLo(i,1,2) = 0;
MemStLo(i,1,3) = 0;
MemStLo(i,1,4) = -E*A/L;
MemStLo(i,1,5) = 0;
MemStLo(i,1,6) = 0;

MemStLo(i,2,1) = 0;
MemStLo(i,2,2) = 0;
MemStLo(i,2,3) = 0;
MemStLo(i,2,4) = 0;
MemStLo(i,2,5) = 0;
MemStLo(i,2,6) = 0;
MemStLo(i,3,1) = 0;
MemStLo(i,3,2) = 0;
MemStLo(i,3,3) = 0;
MemStLo(i,3,4) = 0;
MemStLo(i,3,5) = 0;
MemStLo(i,3,6) = 0;

MemStLo(i,4,1) = -E*A/L;
MemStLo(i,4,2) = 0;
MemStLo(i,4,3) = 0;
MemStLo(i,4,4) = E*A/L;
MemStLo(i,4,5) = 0;
MemStLo(i,4,6) = 0;

MemStLo(i,5,1) = 0;
MemStLo(i,5,2) = 0;
MemStLo(i,5,3) = 0;
MemStLo(i,5,4) = 0;
MemStLo(i,5,5) = 0;
MemStLo(i,5,6) = 0;

MemStLo(i,6,1) = 0;
MemStLo(i,6,2) = 0;
MemStLo(i,6,3) = 0;
MemStLo(i,6,4) = 0;
MemStLo(i,6,5) = 0;
MemStLo(i,6,6) = 0;
end

MemTr(i,1,1) = C;
MemTr(i,2,1) = -S;
MemTr(i,3,1) = 0;
MemTr(i,4,1) = 0;
MemTr(i,5,1) = 0;
MemTr(i,6,1) = 0;
MemTr(i,1,2) = S;
MemTr(i,2,2) = C;
MemTr(i,2,3) = 0;
MemTr(i,2,4) = 0;
MemTr(i,2,5) = 0;
MemTr(i,2,6) = 0;
MemTr(i,3,1) = 0;
MemTr(i,3,2) = 0;
MemTr(i,3,3) = 1;
MemTr(i,3,4) = 0;
MemTr(i,3,5) = 0;
MemTr(i,3,6) = 0;
MemTr(i,4,1) = 0;
MemTr(i,4,2) = 0;
MemTr(i,4,3) = 0;
MemTr(i,4,4) = C;
MemTr(i,4,5) = S;
MemTr(i,4,6) = 0;
MemTr(i,5,1) = 0;
MemTr(i,5,2) = 0;
MemTr(i,5,3) = 0;
MemTr(i,5,4) = -S;
MemTr(i,5,5) = C;
MemTr(i,5,6) = 0;
MemTr(i,6,1) = 0;
MemTr(i,6,2) = 0;
MemTr(i,6,3) = 0;
MemTr(i,6,4) = 0;
MemTr(i,6,5) = 0;
MemTr(i,6,6) = 1;

Type = Member(i,7);
w = Member(i,8);
a = Member(i,9);
b = L-a;
if Release == 0
if Type == 0
PmLo1(i,1) = 0;
PmLo1(i,2) = 0;
PmLo1(i,3) = 0;
PmLo1(i,4) = 0;
PmLo1(i,5) = 0;
PmLo1(i,6) = 0;
elseif Type == 1
PmLo1(i,1) = -w * b / L;
PmLo1(i,2) = 0;
PmLo1(i,3) = 0;
PmLo1(i,4) = -w * a / L;
PmLo1(i,5) = 0;
PmLo1(i,6) = 0;
elseif Type == 2
PmLo1(i,1,1) = -w * L / 2;
PmLo1(i,2) = 0;
PmLo1(i,3) = 0;
PmLo1(i,4) = -w * L / 2;
PmLo1(i,5) = 0;
PmLo1(i,6) = 0;
elseif Type == 3
PmLo1(i,1) = 0;
PmLo1(i,2) = w * L / 2;
PmLo1(i,3) = w * L * L / 12;
PmLo1(i,4) = 0;
PmLo1(i,5) = w * L / 2;
PmLo1(i,6) = -w * L * L / 12;
elseif Type == 4
PmLo1(i,1,1) = 0;
PmLo1(i,2) = w * b / L + w * a * b * (b - a) / L / L / L;
PmLo1(i,3) = w * a * b * b / L / L;
PmLo1(i,4) = 0;
PmLo1(i,5) = w * a / L - w * a * b * (b - a) / L / L / L;
PmLo1(i,6) = -w * b * a * a / L / L;
elseif Type == 5
PmLo1(i,1) = 0;
PmLo1(i,2) = w;
PmLo1(i,3) = w * a * b / L;
PmLo1(i,4) = 0;
PmLo1(i,5) = w;
PmLo1(i,6) = -w * a * b / L;
elseif Type == 6
PmLo1(i,1) = 0;
PmLo1(i,2) = 6 * w * a * b / L / L / L;
PmLo1(i,3) = w * b * (2 * a - b) / L / L;
PmLo1(i,4) = 0;
PmLo1(i,5) = -6 * w * a * b / L / L / L;
PmLo1(i,6) = w * a * (2 * b - a) / L / L;
else
PmLo1(i,1) = 0;
PmLo1(i,2) = w * b / 2;
PmLo1(i,3) = w * b * L * (3 - b * b / L / L) / 24;
PmLo1(i,4) = 0;
PmLo1(i,5) = w * b / 2;
PmLo1(i,6) = -w * b * L * (3 - b * b / L / L) / 24;
end
elseif Release == 1
if Type == 0
PmLo1(i,1) = 0;
PmLo1(i,2) = 0;
PmLo1(i,3) = 0;
PmLo1(i,4) = 0;
PmLo1(i,5) = 0;
PmLo1(i,6) = 0;
elseif Type == 1
PmLo1(i,1) = -w * b / L;
PmLo1(i,2) = 0;
PmLo1(i,3) = 0;
PmLo1(i,4) = -w * a / L;
PmLo1(i,5) = 0;
PmLo1(i,6) = 0;
elseif Type == 2
PmLo1(i,1,1) = -w * L / 2;
PmLo1(i,2) = 0;
PmLo1(i,3) = 0;
PmLo1(i,4) = -w * L / 2;
PmLo1(i,5) = 0;
PmLo1(i,6) = 0;
elseif Type == 3
PmLo1(i,1) = 0;
PmLo1(i,2) = 3 * w * L / 8;
PmLo1(i,3) = 0;
PmLo1(i,4) = 0;
PmLo1(i,5) = 5 * w * L / 8;
PmLo1(i,6) = -w * L * L / 8;
elseif Type == 4
PmLo1(i,1,1) = 0;
PmLo1(i,2) = w * b / L + w * a * b * (b - a) / L / L / L - w * a * b * b / L / L * 1.5 / L;
PmLo1(i,3) = 0;
PmLo1(i,4) = 0;
PmLo1(i,5) = w * a / L - w * a * b * (b - a) / L / L / L + w * a * b * b / L / L * 1.5 / L;
PmLo1(i,6) = -w * b * a * a / L / L - w * a * b * b / L / L / 2;
elseif Type == 5
PmLo1(i,1) = 0;
PmLo1(i,2) = w - w * a * b / L * 1.5 / L;
PmLo1(i,3) = 0;
PmLo1(i,4) = 0;
PmLo1(i,5) = w + w * a * b / L * 1.5 / L;
PmLo1(i,6) = -w * a * b / L - w * a * b / L / 2;
elseif Type == 6
PmLo1(i,1) = 0;
PmLo1(i,2) = 6 * w * a * b / L / L / L - w * b * (2 * a - b) / L / L * 1.5 / L;
PmLo1(i,3) = 0;
PmLo1(i,4) = 0;
PmLo1(i,5) = -6 * w * a * b / L / L / L + w * b * (2 * a - b) / L / L * 1.5 / L;
PmLo1(i,6) = w * a * (2 * b - a) / L / L - w * b * (2 * a - b) / L / L / 2;
else
PmLo1(i,1) = 0;
PmLo1(i,2) = w * b / 2 - w * b * L * (3 - b * b / L / L) / 24 * 1.5 / L;
PmLo1(i,3) = 0;
PmLo1(i,4) = 0;
PmLo1(i,5) = w * b / 2 + w * b * L * (3 - b * b / L / L) / 24 * 1.5 / L;
PmLo1(i,6) = -w * b * L * (3 - b * b / L / L) / 24 * 1.5;
end
elseif Release == 2
if Type == 0
PmLo1(i,1) = 0;
PmLo1(i,2) = 0;
PmLo1(i,3) = 0;
PmLo1(i,4) = 0;
PmLo1(i,5) = 0;
PmLo1(i,6) = 0;
elseif Type == 1
PmLo1(i,1) = -w * b / L;
PmLo1(i,2) = 0;
PmLo1(i,3) = 0;
PmLo1(i,4) = -w * a / L;
PmLo1(i,5) = 0;
PmLo1(i,6) = 0;
elseif Type == 2
PmLo1(i,1,1) = -w * L / 2;
PmLo1(i,2) = 0;
PmLo1(i,3) = 0;
PmLo1(i,4) = -w * L / 2;
PmLo1(i,5) = 0;
PmLo1(i,6) = 0;
elseif Type == 3
PmLo1(i,1) = 0;
PmLo1(i,2) = 5 * w * L / 8;
PmLo1(i,3) = w * L * L / 8;
PmLo1(i,4) = 0;
PmLo1(i,5) = 3 * w * L / 8;
PmLo1(i,6) = 0;
elseif Type == 4
PmLo1(i,1,1) = 0;
PmLo1(i,2) = w * b / L + w * a * b * (b - a) / L / L / L + w * b * a * a / L / L * 1.5 / L;
PmLo1(i,3) = w * a * b * b / L / L + w * b * a * a / L / L / 2;
PmLo1(i,4) = 0;
PmLo1(i,5) = w * a / L - w * a * b * (b - a) / L / L / L - w * b * a * a / L / L * 1.5 / L;
PmLo1(i,6) = 0;
elseif Type == 5
PmLo1(i,1) = 0;
PmLo1(i,2) = w + w * a * b / L * 1.5 / L;
PmLo1(i,3) = w * a * b / L + w * a * b / L / 2;
PmLo1(i,4) = 0;
PmLo1(i,5) = w - w * a * b / L * 1.5 / L;
PmLo1(i,6) = 0;
elseif Type == 6
PmLo1(i,1) = 0;
PmLo1(i,2) = 6 * w * a * b / L / L / L - w * a * (2 * b - a) / L / L * 1.5 / L;
PmLo1(i,3) = w * b * (2 * a - b) / L / L - w * a * (2 * b - a) / L / L / 2;
PmLo1(i,4) = 0;
PmLo1(i,5) = -6 * w * a * b / L / L / L + w * a * (2 * b - a) / L / L * 1.5 / L;
PmLo1(i,6) = 0;
else
PmLo1(i,1) = 0;
PmLo1(i,2) = w * b / 2 + w * b * L * (3 - b * b / L / L) / 24 * 1.5 / L;
PmLo1(i,3) = w * b * L * (3 - b * b / L / L) / 24 + w * b * L * (3 - b * b / L / L) / 24 / 2;
PmLo1(i,4) = 0;
PmLo1(i,5) = w * b / 2 - w * b * L * (3 - b * b / L / L) / 24 / 2;
PmLo1(i,6) = 0;
end
else
if Type == 0
PmLo1(i,1) = 0;
PmLo1(i,2) = 0;
PmLo1(i,3) = 0;
PmLo1(i,4) = 0;
PmLo1(i,5) = 0;
PmLo1(i,6) = 0;
elseif Type == 1
PmLo1(i,1) = -w * b / L;
PmLo1(i,2) = 0;
PmLo1(i,3) = 0;
PmLo1(i,4) = -w * a / L;
PmLo1(i,5) = 0;
PmLo1(i,6) = 0;
elseif Type == 2
PmLo1(i,1,1) = -w * L / 2;
PmLo1(i,2) = 0;
PmLo1(i,3) = 0;
PmLo1(i,4) = -w * L / 2;
PmLo1(i,5) = 0;
PmLo1(i,6) = 0;
elseif Type == 3
PmLo1(i,1) = 0;
PmLo1(i,2) = w * L / 2;
PmLo1(i,3) = 0;
PmLo1(i,4) = 0;
PmLo1(i,5) = w * L / 2;
PmLo1(i,6) = 0;
elseif Type == 4
PmLo1(i,1,1) = 0;
PmLo1(i,2) = w * b / L;
PmLo1(i,3) = 0;
PmLo1(i,4) = 0;
PmLo1(i,5) = w * a / L;
PmLo1(i,6) = 0;
elseif Type == 5
PmLo1(i,1) = 0;
PmLo1(i,2) = w;
PmLo1(i,3) = 0;
PmLo1(i,4) = 0;
PmLo1(i,5) = w;
PmLo1(i,6) = 0;
elseif Type == 6
PmLo1(i,1) = 0;
PmLo1(i,2) = w / L;
PmLo1(i,3) = 0;
PmLo1(i,4) = 0;
PmLo1(i,5) = w / L;
PmLo1(i,6) = 0;
else
PmLo1(i,1) = 0;
PmLo1(i,2) = w * b / 2;
PmLo1(i,3) = 0;
PmLo1(i,4) = 0;
PmLo1(i,5) = w * b / 2;
PmLo1(i,6) = 0;
end
end

Type = Member(i,10);
w = Member(i,11);
a = Member(i,12);
b = L-a;

if Release == 0
if Type == 0
PmLo2(i,1) = 0;
PmLo2(i,2) = 0;
PmLo2(i,3) = 0;
PmLo2(i,4) = 0;
PmLo2(i,5) = 0;
PmLo2(i,6) = 0;
elseif Type == 1
PmLo2(i,1) = -w * b / L;
PmLo2(i,2) = 0;
PmLo2(i,3) = 0;
PmLo2(i,4) = -w * a / L;
PmLo2(i,5) = 0;
PmLo2(i,6) = 0;
elseif Type == 2
PmLo2(i,1,1) = -w * L / 2;
PmLo2(i,2) = 0;
PmLo2(i,3) = 0;
PmLo2(i,4) = -w * L / 2;
PmLo2(i,5) = 0;
PmLo2(i,6) = 0;
elseif Type == 3
PmLo2(i,1) = 0;
PmLo2(i,2) = w * L / 2;
PmLo2(i,3) = w * L * L / 12;
PmLo2(i,4) = 0;
PmLo2(i,5) = w * L / 2;
PmLo2(i,6) = -w * L * L / 12;
elseif Type == 4
PmLo2(i,1,1) = 0;
PmLo2(i,2) = w * b / L + w * a * b * (b - a) / L / L / L;
PmLo2(i,3) = w * a * b * b / L / L;
PmLo2(i,4) = 0;
PmLo2(i,5) = w * a / L - w * a * b * (b - a) / L / L / L;
PmLo2(i,6) = -w * b * a * a / L / L;
elseif Type == 5
PmLo2(i,1) = 0;
PmLo2(i,2) = w;
PmLo2(i,3) = w * a * b / L;
PmLo2(i,4) = 0;
PmLo2(i,5) = w;
PmLo2(i,6) = -w * a * b / L;
elseif Type == 6
PmLo2(i,1) = 0;
PmLo2(i,2) = 6 * w * a * b / L / L / L;
PmLo2(i,3) = w * b * (2 * a - b) / L / L;
PmLo2(i,4) = 0;
PmLo2(i,5) = -6 * w * a * b / L / L / L;
PmLo2(i,6) = w * a * (2 * b - a) / L / L;
else
PmLo2(i,1) = 0;
PmLo2(i,2) = w * b / 2;
PmLo2(i,3) = w * b * L * (3 - b * b / L / L) / 24;
PmLo2(i,4) = 0;
PmLo2(i,5) = w * b / 2;
PmLo2(i,6) = -w * b * L * (3 - b * b / L / L) / 24;
end
elseif Release == 1
if Type == 0
PmLo2(i,1) = 0;
PmLo2(i,2) = 0;
PmLo2(i,3) = 0;
PmLo2(i,4) = 0;
PmLo2(i,5) = 0;
PmLo2(i,6) = 0;
elseif Type == 1
PmLo2(i,1) = -w * b / L;
PmLo2(i,2) = 0;
PmLo2(i,3) = 0;
PmLo2(i,4) = -w * a / L;
PmLo2(i,5) = 0;
PmLo2(i,6) = 0;
elseif Type == 2
PmLo2(i,1,1) = -w * L / 2;
PmLo2(i,2) = 0;
PmLo2(i,3) = 0;
PmLo2(i,4) = -w * L / 2;
PmLo2(i,5) = 0;
PmLo2(i,6) = 0;
elseif Type == 3
PmLo2(i,1) = 0;
PmLo2(i,2) = 3 * w * L / 8;
PmLo2(i,3) = 0;
PmLo2(i,4) = 0;
PmLo2(i,5) = 5 * w * L / 8;
PmLo2(i,6) = -w * L * L / 8;
elseif Type == 4
PmLo2(i,1,1) = 0;
PmLo2(i,2) = w * b / L + w * a * b * (b - a) / L / L / L - w * a * b * b / L / L * 1.5 / L;
PmLo2(i,3) = 0;
PmLo2(i,4) = 0;
PmLo2(i,5) = w * a / L - w * a * b * (b - a) / L / L / L + w * a * b * b / L / L * 1.5 / L;
PmLo2(i,6) = -w * b * a * a / L / L - w * a * b * b / L / L / 2;
elseif Type == 5
PmLo2(i,1) = 0;
PmLo2(i,2) = w - w * a * b / L * 1.5 / L;
PmLo2(i,3) = 0;
PmLo2(i,4) = 0;
PmLo2(i,5) = w + w * a * b / L * 1.5 / L;
PmLo2(i,6) = -w * a * b / L - w * a * b / L / 2;
elseif Type == 6
PmLo2(i,1) = 0;
PmLo2(i,2) = 6 * w * a * b / L / L / L - w * b * (2 * a - b) / L / L * 1.5 / L;
PmLo2(i,3) = 0;
PmLo2(i,4) = 0;
PmLo2(i,5) = -6 * w * a * b / L / L / L + w * b * (2 * a - b) / L / L * 1.5 / L;
PmLo2(i,6) = w * a * (2 * b - a) / L / L - w * b * (2 * a - b) / L / L / 2;
else
PmLo2(i,1) = 0;
PmLo2(i,2) = w * b / 2 - w * b * L * (3 - b * b / L / L) / 24 * 1.5 / L;
PmLo2(i,3) = 0;
PmLo2(i,4) = 0;
PmLo2(i,5) = w * b / 2 + w * b * L * (3 - b * b / L / L) / 24 * 1.5 / L;
PmLo2(i,6) = -w * b * L * (3 - b * b / L / L) / 24 * 1.5;
end
elseif Release == 2
if Type == 0
PmLo2(i,1) = 0;
PmLo2(i,2) = 0;
PmLo2(i,3) = 0;
PmLo2(i,4) = 0;
PmLo2(i,5) = 0;
PmLo2(i,6) = 0;
elseif Type == 1
PmLo2(i,1) = -w * b / L;
PmLo2(i,2) = 0;
PmLo2(i,3) = 0;
PmLo2(i,4) = -w * a / L;
PmLo2(i,5) = 0;
PmLo2(i,6) = 0;
elseif Type == 2
PmLo2(i,1,1) = -w * L / 2;
PmLo2(i,2) = 0;
PmLo2(i,3) = 0;
PmLo2(i,4) = -w * L / 2;
PmLo2(i,5) = 0;
PmLo2(i,6) = 0;
elseif Type == 3
PmLo2(i,1) = 0;
PmLo2(i,2) = 5 * w * L / 8;
PmLo2(i,3) = w * L * L / 8;
PmLo2(i,4) = 0;
PmLo2(i,5) = 3 * w * L / 8;
PmLo2(i,6) = 0;
elseif Type == 4
PmLo2(i,1,1) = 0;
PmLo2(i,2) = w * b / L + w * a * b * (b - a) / L / L / L + w * b * a * a / L / L * 1.5 / L;
PmLo2(i,3) = w * a * b * b / L / L + w * b * a * a / L / L / 2;
PmLo2(i,4) = 0;
PmLo2(i,5) = w * a / L - w * a * b * (b - a) / L / L / L - w * b * a * a / L / L * 1.5 / L;
PmLo2(i,6) = 0;
elseif Type == 5
PmLo2(i,1) = 0;
PmLo2(i,2) = w + w * a * b / L * 1.5 / L;
PmLo2(i,3) = w * a * b / L + w * a * b / L / 2;
PmLo2(i,4) = 0;
PmLo2(i,5) = w - w * a * b / L * 1.5 / L;
PmLo2(i,6) = 0;
elseif Type == 6
PmLo2(i,1) = 0;
PmLo2(i,2) = 6 * w * a * b / L / L / L - w * a * (2 * b - a) / L / L * 1.5 / L;
PmLo2(i,3) = w * b * (2 * a - b) / L / L - w * a * (2 * b - a) / L / L / 2;
PmLo2(i,4) = 0;
PmLo2(i,5) = -6 * w * a * b / L / L / L + w * a * (2 * b - a) / L / L * 1.5 / L;
PmLo2(i,6) = 0;
else
PmLo2(i,1) = 0;
PmLo2(i,2) = w * b / 2 + w * b * L * (3 - b * b / L / L) / 24 * 1.5 / L;
PmLo2(i,3) = w * b * L * (3 - b * b / L / L) / 24 + w * b * L * (3 - b * b / L / L) / 24 / 2;
PmLo2(i,4) = 0;
PmLo2(i,5) = w * b / 2 - w * b * L * (3 - b * b / L / L) / 24 / 2;
PmLo2(i,6) = 0;
end
else
if Type == 0
PmLo2(i,1) = 0;
PmLo2(i,2) = 0;
PmLo2(i,3) = 0;
PmLo2(i,4) = 0;
PmLo2(i,5) = 0;
PmLo2(i,6) = 0;
elseif Type == 1
PmLo2(i,1) = -w * b / L;
PmLo2(i,2) = 0;
PmLo2(i,3) = 0;
PmLo2(i,4) = -w * a / L;
PmLo2(i,5) = 0;
PmLo2(i,6) = 0;
elseif Type == 2
PmLo2(i,1,1) = -w * L / 2;
PmLo2(i,2) = 0;
PmLo2(i,3) = 0;
PmLo2(i,4) = -w * L / 2;
PmLo2(i,5) = 0;
PmLo2(i,6) = 0;
elseif Type == 3
PmLo2(i,1) = 0;
PmLo2(i,2) = w * L / 2;
PmLo2(i,3) = 0;
PmLo2(i,4) = 0;
PmLo2(i,5) = w * L / 2;
PmLo2(i,6) = 0;
elseif Type == 4
PmLo2(i,1,1) = 0;
PmLo2(i,2) = w * b / L;
PmLo2(i,3) = 0;
PmLo2(i,4) = 0;
PmLo2(i,5) = w * a / L;
PmLo2(i,6) = 0;
elseif Type == 5
PmLo2(i,1) = 0;
PmLo2(i,2) = w;
PmLo2(i,3) = 0;
PmLo2(i,4) = 0;
PmLo2(i,5) = w;
PmLo2(i,6) = 0;
elseif Type == 6
PmLo2(i,1) = 0;
PmLo2(i,2) = w / L;
PmLo2(i,3) = 0;
PmLo2(i,4) = 0;
PmLo2(i,5) = w / L;
PmLo2(i,6) = 0;
else
PmLo2(i,1) = 0;
PmLo2(i,2) = w * b / 2;
PmLo2(i,3) = 0;
PmLo2(i,4) = 0;
PmLo2(i,5) = w * b / 2;
PmLo2(i,6) = 0;
end
end

for j = 1:6
PmLo(i,j) = PmLo1(i,j) + PmLo2(i,j);
end

for j = 1:6
for k = 1:6
PmGl(i, j) = MemTr(i,k,j) * PmLo(i,k) + PmGl(i,j);
end
end

for ii = 1:6
for jj = 1:6
for kk = 1:6
MemStGl_1(i,ii,jj) = MemStGl_1(i,ii,jj) + MemTr(i,kk,ii) * MemStLo(i,kk,jj);
end
end
end

for ii = 1:6
for jj = 1:6
for kk = 1:6
MemStGl(i,ii,jj) = MemStGl(i,ii,jj) + MemStGl_1(i,ii,kk) * MemTr(i,kk,jj);
end
end
end

for j = 1:3
for k = 1:3
StGl(NStart+j,NStart+k) = StGl(NStart+j,NStart+k) + MemStGl(i,j,k);
StGl(NEnd+j,NEnd+k) = StGl(NEnd+j,NEnd+k) + MemStGl(i,j+3,k+3);
StGl(NStart+j,NEnd+k) = StGl(NStart+j,NEnd+k) + MemStGl(i,j,k+3);
StGl(NEnd+j,NStart+k) = StGl(NEnd+j,NStart+k) + MemStGl(i,j+3,k);
end
PfGl(NStart+j) = PfGl(NStart+j) + PmGl(i,j);
PfGl(NEnd+j) = PfGl(NEnd+j) + PmGl(i,j+3);
end
end
for i = 1:3*nRNode
PGl(i) = PjGl(i) - PfGl(i);
end
end

function [nDofT,nDofE,nDofC,DofT,DofC,PEl,StEl] = StiffnessEleminate(app,StGl,PGl,nRNode,Node)


nDofT = 0;
nDofE = 0;
nDofC = 0;
DofT = [];
DofC = [];

for i = 1:nRNode
for j = 1:3
nDofT = nDofT+1;
DofT(nDofT) = Node(i,3+j);
if DofT(nDofT) == 0.5
nDofC = nDofC +1;
end
if DofT(nDofT) ~= 0
nDofE = nDofE +1;
DofC(nDofE) = DofT(nDofT);
end

end
end

krEl = 0;
kcEl = 0;

for i = 1:3*nRNode
if DofT(i) ~= 0
krEl = krEl +1;
StEl_1(krEl,:) = StGl(i,:);
PEl(krEl) = PGl(i);
end
end

for i = 1:3*nRNode
if DofT(i) ~= 0
kcEl = kcEl +1;
StEl(:,kcEl) = StEl_1(:,i);
end
end

end

function [StAr, PAr] = StiffnesArrange(app,nDofE,nDofC,StEl,PEl,DofC)


KrCon = 0;
KcCon = 0;

if nDofC == 0
StAr = StEl;
PAr = PEl;
else
for i = 1:nDofE
if DofC(i) == 0.5
StAr_1(nDofE+i-nDofC-KrCon,:) = StEl(i,:);
PAr(nDofE+i-nDofC-KrCon,:) = PEl(i);
else
KrCon = KrCon+1;
StAr_1(KrCon,:) = StEl(i,:);
PAr(KrCon) = PEl(i);
end
end
for i = 1:nDofE
if DofC(i) == 0.5
StAr(:,nDofE+i-nDofC-KcCon) = StAr_1(:,i);
else
KcCon = KcCon+1;
StAr(:,KcCon) = StAr_1(:,i);
end
end
end
end

function [StCon,PCon,StCC,StCE,StEC,StEE,PCC,PEE] = StiffnessCondense(app,nDofE,nDofC,StAr,PAr)

if nDofC == 0
StCon = StAr;
PCon = transpose(PAr);
StCC = StCon;
StCE = [];
StEC = [];
StEE = [];
PCC = PCon;
PEE = [];
else
StCC = StAr(1:nDofE-nDofC,1:nDofE-nDofC);
StCE = StAr(1:nDofE-nDofC,nDofE-nDofC+1:nDofE);
StEC = StCE';
StEE = StAr(nDofE-nDofC+1:nDofE,nDofE-nDofC+1:nDofE);

PCC = PAr(1:nDofE-nDofC);
PEE = PAr(nDofE-nDofC+1:nDofE);

StCon = StCC - (StCE*inv(StEE))*StEC; %#ok<*MINV>


PCon = PCC - (StCE*inv(StEE))*PEE;
end

end

function [UT,UEl,UAr,UCC,UEE] = StiffnessSolver(app,StCon,PCon,StEC,StEE,nDofC,PEE,nDofE,DofC,DofT,nDofT)


UCC = inv(StCon) * PCon;
if nDofC == 0
UAr = UCC;
UEl = UAr;
UEE = [];
else
UEE = inv(StEE) * (PEE - StEC * UCC);
UAr(1:nDofE-nDofC) = UCC;
UAr(nDofE-nDofC+1:nDofE) = UEE;
r = 0;
for i = 1 : nDofE
if DofC(i) == 0.5
UEl(i) = UAr(nDofE-nDofC+i-r);
else
r = r+1;
UEl(i) = UAr(r);
end
end
end
r = 0;
for i = 1 : nDofT
if DofT(i) == 0
UT(i) = 0;
else
r = r + 1;
UT(i) = UEl(r);
end
end
end

function [UmGl,UmLo,MEF] = StiffnessSolverMember(app,nRMember,UT,Member,Node,nRNode,MemTr,MemStLo,PmLo)


for i = 1 : nRMember
for j = 1 : nRNode
if Member(i,2) == Node(j,1)
UmGl(i,1) = UT(3*j-2);
UmGl(i,2) = UT(3*j-1);
UmGl(i,3) = UT(3*j);
end
if Member(i,3) == Node(j,1)
UmGl(i,4) = UT(3*j-2);
UmGl(i,5) = UT(3*j-1);
UmGl(i,6) = UT(3*j);
end
end
for ii = 1 : 6
for jj = 1 : 6
Tr(ii,jj) = MemTr(i,ii,jj);
K(ii,jj) = MemStLo(i,ii,jj);
end
UG(ii) = UmGl(i,ii);
P(ii) = PmLo(i,ii);
end
UL = (Tr) * (transpose(UG));
IntF = K * UL;
for ii = 1 : 6
UmLo(i,ii) = UL(ii);
MEF(i,ii) = IntF(ii) + P(ii);
end
end
end
end

% Callbacks that handle component events


methods (Access = private)

% Code that executes after component creation


function startupFcn(app)
app.nRNode = 0;
app.nRMember = 0;
app.NameNode = 0;
app.NameMember = 0;
app.Node = [];
app.Member = [];
app.ModifyNodeButton.Enable = false;
app.DeleteNodeButton.Enable = false;
app.Button_Up.Enable = false;
app.Button_Down.Enable = false;
app.ModifyMemberButton.Enable = false;
app.DeleteMemberButton.Enable = false;

app.Field_LoadValue1.Enable = false;
app.Field_Loada1.Enable = false;
app.Field_LoadValue2.Enable = false;
app.Field_Loada2.Enable = false;
app.AssembleButton.Enable = false;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = false;
end

% Button pushed function: AddNodeButton


function AddNodeButtonPushed(app, event)
app.nRNode = app.nRNode +1;
app.NameNode = app.NameNode+1;
app.Node(app.nRNode,1) = app.NameNode;
app.Node(app.nRNode,2) = app.Field_Node_X.Value;
app.Node(app.nRNode,3) = app.Field_Node_Y.Value;
if app.Drop_Node_Ux.Value == "Restrained"
app.Node(app.nRNode,4) = 0;
elseif app.Drop_Node_Ux.Value == "Allowed"
app.Node(app.nRNode,4) = 1;
else
app.Node(app.nRNode,4) = 0.5;
end
if app.Drop_Node_Uy.Value == "Restrained"
app.Node(app.nRNode,5) = 0;
elseif app.Drop_Node_Uy.Value == "Allowed"
app.Node(app.nRNode,5) = 1;
else
app.Node(app.nRNode,5) = 0.5;
end
if app.Drop_Node_R.Value == "Restrained"
app.Node(app.nRNode,6) = 0;
elseif app.Drop_Node_R.Value == "Allowed"
app.Node(app.nRNode,6) = 1;
else
app.Node(app.nRNode,6) = 0.5;
end
app.Node(app.nRNode,7) = app.Field_Node_Fx.Value;
app.Node(app.nRNode,8) = app.Field_Node_Fy.Value;
app.Node(app.nRNode,9) = app.Field_Node_M.Value;

app.Table_Node.RowName = linspace(1,app.nRNode,app.nRNode);
app.Table_Node.Data = app.Node;
app.Drop_Nodei.Items = string(app.Node(:,1));
app.Drop_Nodej.Items = string(app.Node(:,1));

app.AssembleButton.Enable = true;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = false;
end

% Cell selection callback: Table_Node


function Table_NodeCellSelection(app, event)
app.ModifyNodeButton.Enable = true;
app.DeleteNodeButton.Enable = true;
app.indices = event.Indices;
if app.indices(1) == 1
app.Button_Up.Enable = false;
else
app.Button_Up.Enable = true;
end
if app.indices(1) == app.nRNode
app.Button_Down.Enable = false;
else
app.Button_Down.Enable = true;
end
app.Field_Node_X.Value = app.Node(app.indices(1),2);
app.Field_Node_Y.Value = app.Node(app.indices(1),3);
if app.Node(app.indices(1),4) == 0
app.Drop_Node_Ux.Value = "Restrained";
elseif app.Node(app.indices(1),4) == 1
app.Drop_Node_Ux.Value = "Allowed";
else
app.Drop_Node_Ux.Value = "Condense";
end
if app.Node(app.indices(1),5) == 0
app.Drop_Node_Uy.Value = "Restrained";
elseif app.Node(app.indices(1),5) == 1
app.Drop_Node_Uy.Value = "Allowed";
else
app.Drop_Node_Uy.Value = "Condense";
end
if app.Node(app.indices(1),6) == 0
app.Drop_Node_R.Value = "Restrained";
elseif app.Node(app.indices(1),6) == 1
app.Drop_Node_R.Value = "Allowed";
else
app.Drop_Node_R.Value = "Condense";
end
app.Field_Node_Fx.Value = app.Node(app.indices(1),7);
app.Field_Node_Fy.Value = app.Node(app.indices(1),8);
app.Field_Node_M.Value = app.Node(app.indices(1),9);
end

% Button pushed function: ModifyNodeButton


function ModifyNodeButtonPushed(app, event)
app.Node(app.indices(1),2) = app.Field_Node_X.Value;
app.Node(app.indices(1),3) = app.Field_Node_Y.Value;
if app.Drop_Node_Ux.Value == "Restrained"
app.Node(app.indices(1),4) = 0;
elseif app.Drop_Node_Ux.Value == "Allowed"
app.Node(app.indices(1),4) = 1;
else
app.Node(app.indices(1),4) = 0.5;
end
if app.Drop_Node_Uy.Value == "Restrained"
app.Node(app.indices(1),5) = 0;
elseif app.Drop_Node_Uy.Value == "Allowed"
app.Node(app.indices(1),5) = 1;
else
app.Node(app.indices(1),5) = 0.5;
end
if app.Drop_Node_R.Value == "Restrained"
app.Node(app.indices(1),6) = 0;
elseif app.Drop_Node_R.Value == "Allowed"
app.Node(app.indices(1),6) = 1;
else
app.Node(app.indices(1),6) = 0.5;
end
app.Node(app.indices(1),7) = app.Field_Node_Fx.Value;
app.Node(app.indices(1),8) = app.Field_Node_Fy.Value;
app.Node(app.indices(1),9) = app.Field_Node_M.Value;

app.Table_Node.RowName = linspace(1,app.nRNode,app.nRNode);
app.Table_Node.Data = app.Node;
app.Drop_Nodei.Items = string(app.Node(:,1));
app.Drop_Nodej.Items = string(app.Node(:,1));

app.AssembleButton.Enable = true;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = false;
end

% Button pushed function: DeleteNodeButton


function DeleteNodeButtonPushed(app, event)
key = 0;
if app.nRMember > 0
for i = 1:app.nRMember
if app.Member(i,2) == app.Node(app.indices(1),1) || app.Member(i,3) == app.Node(app.indices(1),1)
answer = questdlg(strcat("Member ID.(",num2str(app.Member(i,1)),"); has this node as one of its ends; Would you like to:"),
'Warnig', 'Delete Member','Modify Member Nodes First','Delete Member');
switch answer
case 'Delete Member'
for j = i+1:app.nRMember
app.Member(j-1,:) = app.Member(j,:);
end
app.Member(app.nRMember,:) = [];
app.nRMember = app.nRMember - 1;
app.Table_Members.RowName = linspace(1,app.nRMember,app.nRMember);
app.Table_Members.Data = app.Member;
case 'Modify Member Nodes First'
end
key = 1;
break;
end
end
end

if key == 0
for i = app.indices(1)+1:app.nRNode
app.Node(i-1,:) = app.Node(i,:);
end
app.Node(app.nRNode,:) = [];
app.nRNode = app.nRNode - 1;
app.Table_Node.RowName = linspace(1,app.nRNode,app.nRNode);
app.Table_Node.Data = app.Node;
app.Drop_Nodei.Items = string(app.Node(:,1));
app.Drop_Nodej.Items = string(app.Node(:,1));

app.AssembleButton.Enable = true;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = false;
end
end

% Button pushed function: Button_Up


function Button_UpPushed(app, event)
a = app.Node(app.indices(1)-1,:);
app.Node(app.indices(1)-1,:) = app.Node(app.indices(1),:);
app.Node(app.indices(1),:) = a;
app.Table_Node.RowName = linspace(1,app.nRNode,app.nRNode);
app.Table_Node.Data = app.Node;
app.Drop_Nodei.Items = string(app.Node(:,1));
app.Drop_Nodej.Items = string(app.Node(:,1));

app.AssembleButton.Enable = true;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = false;
end

% Button pushed function: Button_Down


function Button_DownPushed(app, event)
a = app.Node(app.indices(1),:);
app.Node(app.indices(1),:) = app.Node(app.indices(1)+1,:);
app.Node(app.indices(1)+1,:) = a;
app.Table_Node.RowName = linspace(1,app.nRNode,app.nRNode);
app.Table_Node.Data = app.Node;
app.Drop_Nodei.Items = string(app.Node(:,1));
app.Drop_Nodej.Items = string(app.Node(:,1));

app.AssembleButton.Enable = true;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = false;
end

% Button pushed function: BrowseButton


function BrowseButtonPushed(app, event)
app.Node = [];
[Name,path] = uigetfile('*.txt');
filePath = strcat(path,Name);
fileID = fopen(filePath,'r');
formatSpec = '%f %f %f %f %f %f %f %f %f';
sizeA = [9 Inf];
if fileID ~= -1
a = fscanf(fileID,formatSpec,sizeA);
fclose(fileID);
nrows = width(a);
key = 1;
for j = 4:6
for i = 1:nrows
if a(j,i)~=0 && a(j,i)~=0.5 && a(j,i)~=1
errordlg(strcat("Error in Row(", num2str(i), "), Col(", num2str(j), ") defining joint restrains"),"Error","modal")
key = 0;
end
end
end
if key == 1
app.nRNode = nrows;
app.Node = transpose(a);
app.Table_Node.RowName = linspace(1,app.nRNode,app.nRNode);
app.Table_Node.Data = app.Node;
app.Field_FileName.Value = filePath;
app.nRNode = height(app.Node);
app.Drop_Nodei.Items = string(app.Node(:,1));
app.Drop_Nodej.Items = string(app.Node(:,1));
else
app.nRNode = 0;
end
end
app.AssembleButton.Enable = true;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = false;
end

% Button pushed function: AddMemberButton


function AddMemberButtonPushed(app, event)
if app.Drop_Nodei.Value == app.Drop_Nodej.Value
errordlg("End Node (j) should be different from Start Node (i)")
else
app.nRMember = app.nRMember +1;
app.Member(app.nRMember,1) = app.nRMember;
app.Member(app.nRMember,2) = str2double(app.Drop_Nodei.Value);
app.Member(app.nRMember,3) = str2double(app.Drop_Nodej.Value);
app.Member(app.nRMember,4) = app.Field_E.Value;
app.Member(app.nRMember,5) = app.Field_A.Value;
app.Member(app.nRMember,6) = app.Field_Ix.Value;
if app.Drop_LoadType1.Value == "None"
app.Member(app.nRMember,7) = 0;
app.Member(app.nRMember,8) = 0;
app.Member(app.nRMember,9) = 0;
elseif app.Drop_LoadType1.Value == "Type 1"
app.Member(app.nRMember,7) = 1;
app.Member(app.nRMember,8) = app.Field_LoadValue1.Value;
app.Member(app.nRMember,9) = app.Field_Loada1.Value;
elseif app.Drop_LoadType1.Value == "Type 2"
app.Member(app.nRMember,7) = 2;
app.Member(app.nRMember,8) = app.Field_LoadValue1.Value;
app.Member(app.nRMember,9) = 0;
elseif app.Drop_LoadType1.Value == "Type 3"
app.Member(app.nRMember,7) = 3;
app.Member(app.nRMember,8) = app.Field_LoadValue1.Value;
app.Member(app.nRMember,9) = 0;
elseif app.Drop_LoadType1.Value == "Type 4"
app.Member(app.nRMember,7) = 4;
app.Member(app.nRMember,8) = app.Field_LoadValue1.Value;
app.Member(app.nRMember,9) = app.Field_Loada1.Value;
elseif app.Drop_LoadType1.Value == "Type 5"
app.Member(app.nRMember,7) = 5;
app.Member(app.nRMember,8) = app.Field_LoadValue1.Value;
app.Member(app.nRMember,9) = app.Field_Loada1.Value;
elseif app.Drop_LoadType1.Value == "Type 6"
app.Member(app.nRMember,7) = 6;
app.Member(app.nRMember,8) = app.Field_LoadValue1.Value;
app.Member(app.nRMember,9) = app.Field_Loada1.Value;
elseif app.Drop_LoadType1.Value == "Type 7"
app.Member(app.nRMember,7) = 7;
app.Member(app.nRMember,8) = app.Field_LoadValue1.Value;
app.Member(app.nRMember,9) = app.Field_Loada1.Value;
end

if app.Drop_LoadType2.Value == "None"
app.Member(app.nRMember,10) = 0;
app.Member(app.nRMember,11) = 0;
app.Member(app.nRMember,12) = 0;
elseif app.Drop_LoadType2.Value == "Type 1"
app.Member(app.nRMember,10) = 1;
app.Member(app.nRMember,11) = app.Field_LoadValue2.Value;
app.Member(app.nRMember,12) = app.Field_Loada2.Value;
elseif app.Drop_LoadType2.Value == "Type 2"
app.Member(app.nRMember,10) = 2;
app.Member(app.nRMember,11) = app.Field_LoadValue2.Value;
app.Member(app.nRMember,12) = 0;
elseif app.Drop_LoadType2.Value == "Type 3"
app.Member(app.nRMember,10) = 3;
app.Member(app.nRMember,11) = app.Field_LoadValue2.Value;
app.Member(app.nRMember,12) = 0;
elseif app.Drop_LoadType2.Value == "Type 4"
app.Member(app.nRMember,10) = 4;
app.Member(app.nRMember,11) = app.Field_LoadValue2.Value;
app.Member(app.nRMember,12) = app.Field_Loada2;
elseif app.Drop_LoadType2.Value == "Type 5"
app.Member(app.nRMember,10) = 5;
app.Member(app.nRMember,11) = app.Field_LoadValue2.Value;
app.Member(app.nRMember,12) = app.Field_Loada2.Value;
elseif app.Drop_LoadType2.Value == "Type 6"
app.Member(app.nRMember,10) = 6;
app.Member(app.nRMember,11) = app.Field_LoadValue2.Value;
app.Member(app.nRMember,12) = app.Field_Loada2.Value;
elseif app.Drop_LoadType2.Value == "Type 7"
app.Member(app.nRMember,10) = 7;
app.Member(app.nRMember,11) = app.Field_LoadValue2.Value;
app.Member(app.nRMember,12) = app.Field_Loada2.Value;
end

if app.Drop_Release.Value == "None"
app.Member(app.nRMember,13) = 0;
elseif app.Drop_Release.Value == "Start"
app.Member(app.nRMember,13) = 1;
elseif app.Drop_Release.Value == "End"
app.Member(app.nRMember,13) = 2;
else
app.Member(app.nRMember,13) = 3;
end

app.Table_Members.RowName = linspace(1,app.nRMember,app.nRMember);
app.Table_Members.Data = app.Member;

app.AssembleButton.Enable = true;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = false;
end
end

% Button pushed function: ModifyMemberButton


function ModifyMemberButtonPushed(app, event)
if app.Drop_Nodei.Value == app.Drop_Nodej.Value
errordlg("End Node (j) should be different from Start Node (i)")
else
app.Member(app.indices2(1),2) = str2double(app.Drop_Nodei.Value);
app.Member(app.indices2(1),3) = str2double(app.Drop_Nodej.Value);
app.Member(app.indices2(1),4) = app.Field_E.Value;
app.Member(app.indices2(1),5) = app.Field_A.Value;
app.Member(app.indices2(1),6) = app.Field_Ix.Value;
if app.Drop_LoadType1.Value == "None"
app.Member(app.indices2(1),7) = 0;
app.Member(app.indices2(1),8) = 0;
app.Member(app.indices2(1),9) = 0;
elseif app.Drop_LoadType1.Value == "Type 1"
app.Member(app.indices2(1),7) = 1;
app.Member(app.indices2(1),8) = app.Field_LoadValue1.Value;
app.Member(app.indices2(1),9) = app.Field_Loada1.Value;
elseif app.Drop_LoadType1.Value == "Type 2"
app.Member(app.indices2(1),7) = 2;
app.Member(app.indices2(1),8) = app.Field_LoadValue1.Value;
app.Member(app.indices2(1),9) = 0;
elseif app.Drop_LoadType1.Value == "Type 3"
app.Member(app.indices2(1),7) = 3;
app.Member(app.indices2(1),8) = app.Field_LoadValue1.Value;
app.Member(app.indices2(1),9) = 0;
elseif app.Drop_LoadType1.Value == "Type 4"
app.Member(app.indices2(1),7) = 4;
app.Member(app.indices2(1),8) = app.Field_LoadValue1.Value;
app.Member(app.indices2(1),9) = app.Field_Loada1.Value;
elseif app.Drop_LoadType1.Value == "Type 5"
app.Member(app.indices2(1),7) = 5;
app.Member(app.indices2(1),8) = app.Field_LoadValue1.Value;
app.Member(app.indices2(1),9) = app.Field_Loada1.Value;
elseif app.Drop_LoadType1.Value == "Type 6"
app.Member(app.indices2(1),7) = 6;
app.Member(app.indices2(1),8) = app.Field_LoadValue1.Value;
app.Member(app.indices2(1),9) = app.Field_Loada1.Value;
elseif app.Drop_LoadType1.Value == "Type 7"
app.Member(app.indices2(1),7) = 7;
app.Member(app.indices2(1),8) = app.Field_LoadValue1.Value;
app.Member(app.indices2(1),9) = app.Field_Loada1.Value;
end

if app.Drop_LoadType2.Value == "None"
app.Member(app.indices2(1),10) = 0;
app.Member(app.indices2(1),11) = 0;
app.Member(app.indices2(1),12) = 0;
elseif app.Drop_LoadType2.Value == "Type 1"
app.Member(app.indices2(1),10) = 1;
app.Member(app.indices2(1),11) = app.Field_LoadValue2.Value;
app.Member(app.indices2(1),12) = app.Field_Loada2.Value;
elseif app.Drop_LoadType2.Value == "Type 2"
app.Member(app.indices2(1),10) = 2;
app.Member(app.indices2(1),11) = app.Field_LoadValue2.Value;
app.Member(app.indices2(1),12) = 0;
elseif app.Drop_LoadType2.Value == "Type 3"
app.Member(app.indices2(1),10) = 3;
app.Member(app.indices2(1),11) = app.Field_LoadValue2.Value;
app.Member(app.indices2(1),12) = 0;
elseif app.Drop_LoadType2.Value == "Type 4"
app.Member(app.indices2(1),10) = 4;
app.Member(app.indices2(1),11) = app.Field_LoadValue2.Value;
app.Member(app.indices2(1),12) = app.Field_Loada2;
elseif app.Drop_LoadType2.Value == "Type 5"
app.Member(app.indices2(1),10) = 5;
app.Member(app.indices2(1),11) = app.Field_LoadValue2.Value;
app.Member(app.indices2(1),12) = app.Field_Loada2.Value;
elseif app.Drop_LoadType2.Value == "Type 6"
app.Member(app.indices2(1),10) = 6;
app.Member(app.indices2(1),11) = app.Field_LoadValue2.Value;
app.Member(app.indices2(1),12) = app.Field_Loada2.Value;
elseif app.Drop_LoadType2.Value == "Type 7"
app.Member(app.indices2(1),10) = 7;
app.Member(app.indices2(1),11) = app.Field_LoadValue2.Value;
app.Member(app.indices2(1),12) = app.Field_Loada2.Value;
end

if app.Drop_Release.Value == "None"
app.Member(app.nRMember,13) = 0;
elseif app.Drop_Release.Value == "Start"
app.Member(app.nRMember,13) = 1;
elseif app.Drop_Release.Value == "End"
app.Member(app.nRMember,13) = 2;
else
app.Member(app.nRMember,13) = 3;
end

app.Table_Members.RowName = linspace(1,app.nRMember,app.nRMember);
app.Table_Members.Data = app.Member;

app.AssembleButton.Enable = true;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = false;
end
end

% Cell selection callback: Table_Members


function Table_MembersCellSelection(app, event)
app.ModifyMemberButton.Enable = true;
app.DeleteMemberButton.Enable = true;
app.indices2 = event.Indices;

app.Drop_Nodei.Value = string(app.Member(app.indices2(1),2));
app.Drop_Nodej.Value = string(app.Member(app.indices2(1),3));
app.Field_E.Value = app.Member(app.indices2(1),4);
app.Field_A.Value = app.Member(app.indices2(1),5);
app.Field_Ix.Value = app.Member(app.indices2(1),6);
if app.Member(app.indices2(1),7) == 0
app.Drop_LoadType1.Value = "None";
elseif app.Member(app.indices2(1),7) == 1
app.Drop_LoadType1.Value = "Type 1";
elseif app.Member(app.indices2(1),7) == 2
app.Drop_LoadType1.Value = "Type 2";
elseif app.Member(app.indices2(1),7) == 3
app.Drop_LoadType1.Value = "Type 3";
elseif app.Member(app.indices2(1),7) == 4
app.Drop_LoadType1.Value = "Type 4";
elseif app.Member(app.indices2(1),7) == 5
app.Drop_LoadType1.Value = "Type 5";
elseif app.Member(app.indices2(1),7) == 6
app.Drop_LoadType1.Value = "Type 6";
elseif app.Member(app.indices2(1),7) == 7
app.Drop_LoadType1.Value = "Type 7";
end
app.Field_LoadValue1.Value = app.Member(app.indices2(1),8);
app.Field_Loada1.Value = app.Member(app.indices2(1),9);

if app.Drop_LoadType1.Value == "None"
app.Field_LoadValue1.Enable = false;
app.Field_Loada1.Enable = false;
elseif app.Drop_LoadType1.Value == "Type 2" || app.Drop_LoadType1.Value == "Type 3"
app.Field_LoadValue1.Enable = true;
app.Field_Loada1.Enable = false;
else
app.Field_LoadValue1.Enable = true;
app.Field_Loada1.Enable = true;
end

if app.Member(app.indices2(1),10) == 0
app.Drop_LoadType2.Value = "None";
elseif app.Member(app.indices2(1),10) == 1
app.Drop_LoadType2.Value = "Type 1";
elseif app.Member(app.indices2(1),10) == 2
app.Drop_LoadType2.Value = "Type 2";
elseif app.Member(app.indices2(1),10) == 3
app.Drop_LoadType2.Value = "Type 3";
elseif app.Member(app.indices2(1),10) == 4
app.Drop_LoadType2.Value = "Type 4";
elseif app.Member(app.indices2(1),10) == 5
app.Drop_LoadType2.Value = "Type 5";
elseif app.Member(app.indices2(1),10) == 6
app.Drop_LoadType2.Value = "Type 6";
elseif app.Member(app.indices2(1),10) == 7
app.Drop_LoadType12.Value = "Type 7";
end
app.Field_LoadValue2.Value = app.Member(app.indices2(1),11);
app.Field_Loada2.Value = app.Member(app.indices2(1),12);

if app.Drop_LoadType2.Value == "None"
app.Field_LoadValue2.Enable = false;
app.Field_Loada2.Enable = false;
elseif app.Drop_LoadType2.Value == "Type 2" || app.Drop_LoadType2.Value == "Type 3"
app.Field_LoadValue2.Enable = true;
app.Field_Loada2.Enable = false;
else
app.Field_LoadValue2.Enable = true;
app.Field_Loada2.Enable = true;
end

if app.Member(app.indices2(1),13) == 0
app.Drop_Release.Value = "None";
elseif app.Member(app.indices2(1),13) == 1
app.Drop_Release.Value = "Start";
elseif app.Member(app.indices2(1),13) == 2
app.Drop_Release.Value = "End";
else
app.Drop_Release.Value = "Both";
end

end

% Value changed function: Drop_LoadType1


function Drop_LoadType1ValueChanged(app, event)
if app.Drop_LoadType1.Value == "None"
app.Field_LoadValue1.Enable = false;
app.Field_Loada1.Enable = false;
elseif app.Drop_LoadType1.Value == "Type 2" || app.Drop_LoadType1.Value == "Type 3"
app.Field_LoadValue1.Enable = true;
app.Field_Loada1.Enable = false;
else
app.Field_LoadValue1.Enable = true;
app.Field_Loada1.Enable = true;
end
end

% Value changed function: Drop_LoadType2


function Drop_LoadType2ValueChanged(app, event)
if app.Drop_LoadType2.Value == "None"
app.Field_LoadValue2.Enable = false;
app.Field_Loada2.Enable = false;
elseif app.Drop_LoadType2.Value == "Type 2" || app.Drop_LoadType2.Value == "Type 3"
app.Field_LoadValue2.Enable = true;
app.Field_Loada2.Enable = false;
else
app.Field_LoadValue2.Enable = true;
app.Field_Loada2.Enable = true;
end
end

% Button pushed function: DeleteMemberButton


function DeleteMemberButtonPushed(app, event)
for i = app.indices2(1)+1:app.nRMember
app.Member(i-1,:) = app.Member(i,:);
end
app.Member(app.nRMember,:) = [];
app.nRMember = app.nRMember - 1;
app.Table_Members.RowName = linspace(1,app.nRMember,app.nRMember);
app.Table_Members.Data = app.Member;

if app.nRMember == 0
app.AssembleButton.Enable = false;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = false;
else
app.AssembleButton.Enable = true;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = false;
end
end

% Button pushed function: Button_Export


function Button_ExportPushed(app, event)
selpath1 = uigetdir('C:\');
filename = strcat(selpath1,"\Nodes.txt");
writematrix(app.Node,filename,'Delimiter','tab');
end

% Button pushed function: Button_Export_2


function Button_Export_2Pushed(app, event)
selpath1 = uigetdir('C:\');
filename = strcat(selpath1,"\Members.txt");
writematrix(app.Member,filename,'Delimiter','tab');
end

% Button pushed function: BrowseButton_2


function BrowseButton_2Pushed(app, event)
app.Member = [];
[Name,path] = uigetfile('*.txt');
filePath = strcat(path,Name);
fileID = fopen(filePath,'r');
formatSpec = '%f %f %f %f %f %f %f %f %f %f %f %f %f';
sizeA = [13 Inf];

app.AssembleButton.Enable = false;

if fileID ~= -1
a = fscanf(fileID,formatSpec,sizeA);
fclose(fileID);
nrows = width(a);
key = 1;
for j = [7 10]
for i = 1:nrows
if a(j,i)~=0 && a(j,i)~=1 && a(j,i)~=2 && a(j,i)~=3 && a(j,i)~=4 && a(j,i)~=5 && a(j,i)~=6 && a(j,i)~=7
errordlg(strcat("Error in Row(", num2str(i), "), Col(", num2str(j), ") defining member load"),"Error","modal")
key = 0;
end
end
end
for j = 13
for i = 1:nrows
if a(j,i)~=0 && a(j,i)~=1 && a(j,i)~=2 && a(j,i)~=3
errordlg(strcat("Error in Row(", num2str(i), "), Col(", num2str(j), ") defining member end release"),"Error","modal")
key = 0;
end
end
end
if key == 1
app.nRMember = nrows;
app.Member = transpose(a);
app.Table_Members.RowName = linspace(1,app.nRMember,app.nRMember);
app.Table_Members.Data = app.Member;
app.Field_FileName_2.Value = filePath;
else
app.nRMember = 0;
end
app.AssembleButton.Enable = true;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = false;
else
app.AssembleButton.Enable = false;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = false;
end
end

% Button pushed function: AssembleButton


function AssembleButtonPushed(app, event)
[app.PjGl,app.MemTr,app.MemStLo,app.MemStGl,app.PmLo,app.PmGl,app.PfGl,app.StGl,app.PGl] =
StiffnessTotal(app,app.nRNode,app.Node,app.nRMember,app.Member);

app.selpath = uigetdir('C:\');
app.Field_FileDirectory.Value = app.selpath;

filename = strcat(app.selpath,"\1.1) StGl.txt");


writematrix(app.StGl,filename,'Delimiter','tab');

filename = strcat(app.selpath,"\1.2) PjGl.txt");


writematrix(app.PjGl,filename,'Delimiter','tab');

filename = strcat(app.selpath,"\1.3) PfGl.txt");


writematrix(app.PfGl,filename,'Delimiter','tab');

filename = strcat(app.selpath,"\1.4) PGl.txt");


writematrix(app.PGl,filename,'Delimiter','tab');

app.AssembleButton.Enable = false;
app.EleminateButton.Enable = true;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = false;
end

% Button pushed function: EleminateButton


function EleminateButtonPushed(app, event)
[app.nDofT,app.nDofE,app.nDofC,app.DofT,app.DofC,app.PEl,app.StEl] =
StiffnessEleminate(app,app.StGl,app.PGl,app.nRNode,app.Node);

filename = strcat(app.selpath,"\2.1) StEl.txt");


writematrix(app.StEl,filename,'Delimiter','tab');
filename = strcat(app.selpath,"\2.2) PEl.txt");
writematrix(app.PEl',filename,'Delimiter','tab');

app.AssembleButton.Enable = false;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = true;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = false;
end

% Button pushed function: ArrangeButton


function ArrangeButtonPushed(app, event)
[app.StAr, app.PAr] = StiffnesArrange(app,app.nDofE,app.nDofC,app.StEl,app.PEl,app.DofC);

filename = strcat(app.selpath,"\3.1) StAr.txt");


writematrix(app.StAr,filename,'Delimiter','tab');
filename = strcat(app.selpath,"\3.2) PAr.txt");
writematrix(app.PAr',filename,'Delimiter','tab');

app.AssembleButton.Enable = false;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = true;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = false;
end

% Button pushed function: CondenseButton


function CondenseButtonPushed(app, event)
[app.StCon,app.PCon,app.StCC,app.StCE,app.StEC,app.StEE,app.PCC,app.PEE] =
StiffnessCondense(app,app.nDofE,app.nDofC,app.StAr,app.PAr);

filename = strcat(app.selpath,"\4.1) StCon.txt");


writematrix(app.StCon,filename,'Delimiter','tab');

filename = strcat(app.selpath,"\4.2) PCon.txt");


writematrix(app.PCon',filename,'Delimiter','tab');

filename = strcat(app.selpath,"\4.3) StCC.txt");


writematrix(app.StCC,filename,'Delimiter','tab');

filename = strcat(app.selpath,"\4.4) StCE.txt");


writematrix(app.StCE,filename,'Delimiter','tab');

filename = strcat(app.selpath,"\4.5) StEC.txt");


writematrix(app.StEC,filename,'Delimiter','tab');

filename = strcat(app.selpath,"\4.6) StEE.txt");


writematrix(app.StEE,filename,'Delimiter','tab');

filename = strcat(app.selpath,"\4.7) PCC.txt");


writematrix(app.PCC',filename,'Delimiter','tab');

filename = strcat(app.selpath,"\4.8) PEE.txt");


writematrix(app.PEE',filename,'Delimiter','tab');

app.AssembleButton.Enable = false;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = true;
app.SolveMembersButton.Enable = false;
end

% Button pushed function: SolveDOFButton


function SolveDOFButtonPushed(app, event)
[app.UT,app.UEl,app.UAr,app.UCC,app.UEE] =
StiffnessSolver(app,app.StCon,app.PCon,app.StEC,app.StEE,app.nDofC,app.PEE,app.nDofE,app.DofC,app.DofT,app.nDofT);

filename = strcat(app.selpath,"\5.1) UCC.txt");


writematrix(app.UCC,filename,'Delimiter','tab');

filename = strcat(app.selpath,"\5.2) UEE.txt");


writematrix(app.UEE,filename,'Delimiter','tab');

filename = strcat(app.selpath,"\5.3) UAr.txt");


writematrix(app.UAr,filename,'Delimiter','tab');

filename = strcat(app.selpath,"\5.4) UEl.txt");


writematrix(app.UEl,filename,'Delimiter','tab');

filename = strcat(app.selpath,"\5.5) UT.txt");


writematrix(app.UT,filename,'Delimiter','tab');

app.AssembleButton.Enable = false;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = true;
end

% Button pushed function: SolveMembersButton


function SolveMembersButtonPushed(app, event)
[app.UmGl,app.UmLo,app.MEF] =
StiffnessSolverMember(app,app.nRMember,app.UT,app.Member,app.Node,app.nRNode,app.MemTr,app.MemStLo,app.PmLo);

filename = strcat(app.selpath,"\6.1) UmGl.txt");


writematrix(app.UmGl,filename,'Delimiter','tab');

filename = strcat(app.selpath,"\6.2) UmLo.txt");


writematrix(app.UmLo,filename,'Delimiter','tab');

filename = strcat(app.selpath,"\6.3) MEF.txt");


writematrix(app.MEF,filename,'Delimiter','tab');

app.AssembleButton.Enable = false;
app.EleminateButton.Enable = false;
app.ArrangeButton.Enable = false;
app.CondenseButton.Enable = false;
app.SolveDOFButton.Enable = false;
app.SolveMembersButton.Enable = false;
end
end

% Component initialization
methods (Access = private)

% Create UIFigure and components


function createComponents(app)

% Create Stiffness2DUIFigure and hide until all components are created


app.Stiffness2DUIFigure = uifigure('Visible', 'off');
app.Stiffness2DUIFigure.AutoResizeChildren = 'off';
app.Stiffness2DUIFigure.Position = [100 100 740 425];
app.Stiffness2DUIFigure.Name = 'Stiffness 2D';
app.Stiffness2DUIFigure.Icon = 'Icon.png';
app.Stiffness2DUIFigure.Resize = 'off';
% Create TabGroup
app.TabGroup = uitabgroup(app.Stiffness2DUIFigure);
app.TabGroup.AutoResizeChildren = 'off';
app.TabGroup.Position = [1 1 740 425];

% Create NodesTab
app.NodesTab = uitab(app.TabGroup);
app.NodesTab.AutoResizeChildren = 'off';
app.NodesTab.Title = 'Nodes';

% Create Table_Node
app.Table_Node = uitable(app.NodesTab);
app.Table_Node.ColumnName = {'Node'; 'X'; 'Y'; 'Ux'; 'Uy'; 'Ѳ'; 'Fx'; 'Fy'; 'M'};
app.Table_Node.ColumnWidth = {60, 60, 60, 60, 60, 60, 60, 60, 60};
app.Table_Node.RowName = {};
app.Table_Node.ColumnEditable = [true false false false false false false false false];
app.Table_Node.CellSelectionCallback = createCallbackFcn(app, @Table_NodeCellSelection, true);
app.Table_Node.Position = [185 125 542 265];

% Create Panel
app.Panel = uipanel(app.NodesTab);
app.Panel.AutoResizeChildren = 'off';
app.Panel.Position = [10 55 165 335];

% Create Field_Node_X
app.Field_Node_X = uieditfield(app.Panel, 'numeric');
app.Field_Node_X.HorizontalAlignment = 'center';
app.Field_Node_X.FontColor = [0 0 1];
app.Field_Node_X.Position = [70 305 90 25];

% Create Field_Node_Y
app.Field_Node_Y = uieditfield(app.Panel, 'numeric');
app.Field_Node_Y.HorizontalAlignment = 'center';
app.Field_Node_Y.FontColor = [0 0 1];
app.Field_Node_Y.Position = [70 275 90 25];

% Create Field_Node_Fy
app.Field_Node_Fy = uieditfield(app.Panel, 'numeric');
app.Field_Node_Fy.HorizontalAlignment = 'center';
app.Field_Node_Fy.FontColor = [0 0 1];
app.Field_Node_Fy.Position = [70 125 90 25];

% Create Field_Node_Fx
app.Field_Node_Fx = uieditfield(app.Panel, 'numeric');
app.Field_Node_Fx.HorizontalAlignment = 'center';
app.Field_Node_Fx.FontColor = [0 0 1];
app.Field_Node_Fx.Position = [70 155 90 25];

% Create Field_Node_M
app.Field_Node_M = uieditfield(app.Panel, 'numeric');
app.Field_Node_M.HorizontalAlignment = 'center';
app.Field_Node_M.FontColor = [0 0 1];
app.Field_Node_M.Position = [70 95 90 25];

% Create FxLabel
app.FxLabel = uilabel(app.Panel);
app.FxLabel.FontName = 'Times New Roman';
app.FxLabel.FontSize = 16;
app.FxLabel.FontWeight = 'bold';
app.FxLabel.Position = [5 155 60 25];
app.FxLabel.Text = 'Fx';

% Create MLabel
app.MLabel = uilabel(app.Panel);
app.MLabel.FontName = 'Times New Roman';
app.MLabel.FontSize = 16;
app.MLabel.FontWeight = 'bold';
app.MLabel.Position = [5 95 60 25];
app.MLabel.Text = 'M';
% Create FyLabel
app.FyLabel = uilabel(app.Panel);
app.FyLabel.FontName = 'Times New Roman';
app.FyLabel.FontSize = 16;
app.FyLabel.FontWeight = 'bold';
app.FyLabel.Position = [5 125 60 25];
app.FyLabel.Text = 'Fy';

% Create Label
app.Label = uilabel(app.Panel);
app.Label.FontName = 'Times New Roman';
app.Label.FontSize = 16;
app.Label.FontWeight = 'bold';
app.Label.Position = [5 185 60 25];
app.Label.Text = 'Ѳ';

% Create UyLabel
app.UyLabel = uilabel(app.Panel);
app.UyLabel.FontName = 'Times New Roman';
app.UyLabel.FontSize = 16;
app.UyLabel.FontWeight = 'bold';
app.UyLabel.Position = [5 215 60 25];
app.UyLabel.Text = 'Uy';

% Create UxLabel
app.UxLabel = uilabel(app.Panel);
app.UxLabel.FontName = 'Times New Roman';
app.UxLabel.FontSize = 16;
app.UxLabel.FontWeight = 'bold';
app.UxLabel.Position = [5 245 60 25];
app.UxLabel.Text = 'Ux';

% Create YLabel
app.YLabel = uilabel(app.Panel);
app.YLabel.FontName = 'Times New Roman';
app.YLabel.FontSize = 16;
app.YLabel.FontWeight = 'bold';
app.YLabel.Position = [5 275 60 25];
app.YLabel.Text = 'Y';

% Create XLabel
app.XLabel = uilabel(app.Panel);
app.XLabel.FontName = 'Times New Roman';
app.XLabel.FontSize = 16;
app.XLabel.FontWeight = 'bold';
app.XLabel.Position = [5 305 60 25];
app.XLabel.Text = 'X';

% Create Drop_Node_Ux
app.Drop_Node_Ux = uidropdown(app.Panel);
app.Drop_Node_Ux.Items = {'Restrained', 'Allowed', 'Condense'};
app.Drop_Node_Ux.FontName = 'Times New Roman';
app.Drop_Node_Ux.FontWeight = 'bold';
app.Drop_Node_Ux.FontColor = [0 0 1];
app.Drop_Node_Ux.Position = [70 245 90 25];
app.Drop_Node_Ux.Value = 'Restrained';

% Create Drop_Node_Uy
app.Drop_Node_Uy = uidropdown(app.Panel);
app.Drop_Node_Uy.Items = {'Restrained', 'Allowed', 'Condense'};
app.Drop_Node_Uy.FontName = 'Times New Roman';
app.Drop_Node_Uy.FontWeight = 'bold';
app.Drop_Node_Uy.FontColor = [0 0 1];
app.Drop_Node_Uy.Position = [70 215 90 25];
app.Drop_Node_Uy.Value = 'Restrained';

% Create Drop_Node_R
app.Drop_Node_R = uidropdown(app.Panel);
app.Drop_Node_R.Items = {'Restrained', 'Allowed', 'Condense'};
app.Drop_Node_R.FontName = 'Times New Roman';
app.Drop_Node_R.FontWeight = 'bold';
app.Drop_Node_R.FontColor = [0 0 1];
app.Drop_Node_R.Position = [70 185 90 25];
app.Drop_Node_R.Value = 'Restrained';

% Create AddNodeButton
app.AddNodeButton = uibutton(app.Panel, 'push');
app.AddNodeButton.ButtonPushedFcn = createCallbackFcn(app, @AddNodeButtonPushed, true);
app.AddNodeButton.FontName = 'Times';
app.AddNodeButton.FontSize = 16;
app.AddNodeButton.FontWeight = 'bold';
app.AddNodeButton.Position = [5 65 155 25];
app.AddNodeButton.Text = 'Add Node';

% Create ModifyNodeButton
app.ModifyNodeButton = uibutton(app.Panel, 'push');
app.ModifyNodeButton.ButtonPushedFcn = createCallbackFcn(app, @ModifyNodeButtonPushed, true);
app.ModifyNodeButton.FontName = 'Times';
app.ModifyNodeButton.FontSize = 16;
app.ModifyNodeButton.FontWeight = 'bold';
app.ModifyNodeButton.Position = [5 35 155 25];
app.ModifyNodeButton.Text = 'Modify Node';

% Create DeleteNodeButton
app.DeleteNodeButton = uibutton(app.Panel, 'push');
app.DeleteNodeButton.ButtonPushedFcn = createCallbackFcn(app, @DeleteNodeButtonPushed, true);
app.DeleteNodeButton.FontName = 'Times';
app.DeleteNodeButton.FontSize = 16;
app.DeleteNodeButton.FontWeight = 'bold';
app.DeleteNodeButton.Position = [5 5 155 25];
app.DeleteNodeButton.Text = 'Delete Node';

% Create Panel_2
app.Panel_2 = uipanel(app.NodesTab);
app.Panel_2.AutoResizeChildren = 'off';
app.Panel_2.Position = [10 10 725 35];

% Create FromFileLabel
app.FromFileLabel = uilabel(app.Panel_2);
app.FromFileLabel.FontName = 'Times New Roman';
app.FromFileLabel.FontSize = 16;
app.FromFileLabel.FontWeight = 'bold';
app.FromFileLabel.Position = [5 5 80 25];
app.FromFileLabel.Text = 'From File';

% Create BrowseButton
app.BrowseButton = uibutton(app.Panel_2, 'push');
app.BrowseButton.ButtonPushedFcn = createCallbackFcn(app, @BrowseButtonPushed, true);
app.BrowseButton.FontName = 'Times';
app.BrowseButton.FontSize = 16;
app.BrowseButton.FontWeight = 'bold';
app.BrowseButton.Position = [630 5 90 25];
app.BrowseButton.Text = 'Browse';

% Create Field_FileName
app.Field_FileName = uieditfield(app.Panel_2, 'text');
app.Field_FileName.Editable = 'off';
app.Field_FileName.HorizontalAlignment = 'right';
app.Field_FileName.FontName = 'Times New Roman';
app.Field_FileName.FontSize = 16;
app.Field_FileName.FontAngle = 'italic';
app.Field_FileName.Enable = 'off';
app.Field_FileName.Position = [80 5 545 25];

% Create Panel_3
app.Panel_3 = uipanel(app.NodesTab);
app.Panel_3.AutoResizeChildren = 'off';
app.Panel_3.BorderType = 'none';
app.Panel_3.Position = [615 55 115 60];
% Create Button_Up
app.Button_Up = uibutton(app.Panel_3, 'push');
app.Button_Up.ButtonPushedFcn = createCallbackFcn(app, @Button_UpPushed, true);
app.Button_Up.Icon = 'UpButton.png';
app.Button_Up.FontName = 'Times';
app.Button_Up.FontSize = 16;
app.Button_Up.FontWeight = 'bold';
app.Button_Up.Position = [5 6 50 50];
app.Button_Up.Text = '';

% Create Button_Down
app.Button_Down = uibutton(app.Panel_3, 'push');
app.Button_Down.ButtonPushedFcn = createCallbackFcn(app, @Button_DownPushed, true);
app.Button_Down.Icon = 'DownButton.png';
app.Button_Down.FontName = 'Times';
app.Button_Down.FontSize = 16;
app.Button_Down.FontWeight = 'bold';
app.Button_Down.Position = [60 6 50 50];
app.Button_Down.Text = '';

% Create Button_Export
app.Button_Export = uibutton(app.NodesTab, 'push');
app.Button_Export.ButtonPushedFcn = createCallbackFcn(app, @Button_ExportPushed, true);
app.Button_Export.Icon = 'ExportButton.png';
app.Button_Export.FontName = 'Times';
app.Button_Export.FontSize = 16;
app.Button_Export.FontWeight = 'bold';
app.Button_Export.Position = [185 60 50 50];
app.Button_Export.Text = '';

% Create MembersTab
app.MembersTab = uitab(app.TabGroup);
app.MembersTab.AutoResizeChildren = 'off';
app.MembersTab.Title = 'Members';

% Create Table_Members
app.Table_Members = uitable(app.MembersTab);
app.Table_Members.ColumnName = {'Member'; 'Node (i)'; 'Node (j)'; 'E'; 'A'; 'Ix'; 'Load-1'; 'Value'; 'a'; 'Load-2'; 'Value'; 'a'; 'Releases'};
app.Table_Members.ColumnWidth = {60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60};
app.Table_Members.RowName = {};
app.Table_Members.CellSelectionCallback = createCallbackFcn(app, @Table_MembersCellSelection, true);
app.Table_Members.Position = [188 125 542 260];

% Create Panel_4
app.Panel_4 = uipanel(app.MembersTab);
app.Panel_4.AutoResizeChildren = 'off';
app.Panel_4.Position = [5 25 165 365];

% Create Field_Ix
app.Field_Ix = uieditfield(app.Panel_4, 'numeric');
app.Field_Ix.HorizontalAlignment = 'center';
app.Field_Ix.FontColor = [0 0 1];
app.Field_Ix.Position = [70 215 90 25];

% Create Field_LoadValue1
app.Field_LoadValue1 = uieditfield(app.Panel_4, 'numeric');
app.Field_LoadValue1.HorizontalAlignment = 'center';
app.Field_LoadValue1.FontColor = [0 0 1];
app.Field_LoadValue1.Position = [70 155 90 25];

% Create IxLabel
app.IxLabel = uilabel(app.Panel_4);
app.IxLabel.FontName = 'Times New Roman';
app.IxLabel.FontSize = 16;
app.IxLabel.FontWeight = 'bold';
app.IxLabel.Position = [5 215 60 25];
app.IxLabel.Text = 'Ix';

% Create ValueLabel
app.ValueLabel = uilabel(app.Panel_4);
app.ValueLabel.FontName = 'Times New Roman';
app.ValueLabel.FontSize = 16;
app.ValueLabel.FontWeight = 'bold';
app.ValueLabel.Position = [5 155 60 25];
app.ValueLabel.Text = 'Value';

% Create Load1Label
app.Load1Label = uilabel(app.Panel_4);
app.Load1Label.FontName = 'Times New Roman';
app.Load1Label.FontSize = 16;
app.Load1Label.FontWeight = 'bold';
app.Load1Label.Position = [5 185 60 25];
app.Load1Label.Text = 'Load-1';

% Create ALabel
app.ALabel = uilabel(app.Panel_4);
app.ALabel.FontName = 'Times New Roman';
app.ALabel.FontSize = 16;
app.ALabel.FontWeight = 'bold';
app.ALabel.Position = [5 245 60 25];
app.ALabel.Text = 'A';

% Create ELabel
app.ELabel = uilabel(app.Panel_4);
app.ELabel.FontName = 'Times New Roman';
app.ELabel.FontSize = 16;
app.ELabel.FontWeight = 'bold';
app.ELabel.Position = [5 275 60 25];
app.ELabel.Text = 'E';

% Create NodejLabel
app.NodejLabel = uilabel(app.Panel_4);
app.NodejLabel.FontName = 'Times New Roman';
app.NodejLabel.FontSize = 16;
app.NodejLabel.FontWeight = 'bold';
app.NodejLabel.Position = [5 305 61 25];
app.NodejLabel.Text = 'Node (j)';

% Create NodeiLabel
app.NodeiLabel = uilabel(app.Panel_4);
app.NodeiLabel.FontName = 'Times New Roman';
app.NodeiLabel.FontSize = 16;
app.NodeiLabel.FontWeight = 'bold';
app.NodeiLabel.Position = [5 335 60 25];
app.NodeiLabel.Text = 'Node (i)';

% Create Drop_Nodei
app.Drop_Nodei = uidropdown(app.Panel_4);
app.Drop_Nodei.Items = {};
app.Drop_Nodei.FontName = 'Times New Roman';
app.Drop_Nodei.FontWeight = 'bold';
app.Drop_Nodei.FontColor = [0 0 1];
app.Drop_Nodei.Position = [70 335 90 25];
app.Drop_Nodei.Value = {};

% Create Drop_Nodej
app.Drop_Nodej = uidropdown(app.Panel_4);
app.Drop_Nodej.Items = {};
app.Drop_Nodej.FontName = 'Times New Roman';
app.Drop_Nodej.FontWeight = 'bold';
app.Drop_Nodej.FontColor = [0 0 1];
app.Drop_Nodej.Position = [70 305 90 25];
app.Drop_Nodej.Value = {};

% Create Drop_LoadType1
app.Drop_LoadType1 = uidropdown(app.Panel_4);
app.Drop_LoadType1.Items = {'None', 'Type 1', 'Type 2', 'Type 3', 'Type 4', 'Type 5', 'Type 6', 'Type 7'};
app.Drop_LoadType1.ValueChangedFcn = createCallbackFcn(app, @Drop_LoadType1ValueChanged, true);
app.Drop_LoadType1.FontName = 'Times New Roman';
app.Drop_LoadType1.FontWeight = 'bold';
app.Drop_LoadType1.FontColor = [0 0 1];
app.Drop_LoadType1.Position = [70 185 90 25];
app.Drop_LoadType1.Value = 'None';

% Create Field_E
app.Field_E = uieditfield(app.Panel_4, 'numeric');
app.Field_E.HorizontalAlignment = 'center';
app.Field_E.FontColor = [0 0 1];
app.Field_E.Position = [70 275 90 25];

% Create Field_A
app.Field_A = uieditfield(app.Panel_4, 'numeric');
app.Field_A.HorizontalAlignment = 'center';
app.Field_A.FontColor = [0 0 1];
app.Field_A.Position = [70 245 90 25];

% Create Field_Loada1
app.Field_Loada1 = uieditfield(app.Panel_4, 'numeric');
app.Field_Loada1.HorizontalAlignment = 'center';
app.Field_Loada1.FontColor = [0 0 1];
app.Field_Loada1.Position = [70 125 90 25];

% Create aLabel
app.aLabel = uilabel(app.Panel_4);
app.aLabel.FontName = 'Times New Roman';
app.aLabel.FontSize = 16;
app.aLabel.FontWeight = 'bold';
app.aLabel.Position = [5 125 60 25];
app.aLabel.Text = 'a';

% Create Field_LoadValue2
app.Field_LoadValue2 = uieditfield(app.Panel_4, 'numeric');
app.Field_LoadValue2.HorizontalAlignment = 'center';
app.Field_LoadValue2.FontColor = [0 0 1];
app.Field_LoadValue2.Position = [70 65 90 25];

% Create ValueLabel_2
app.ValueLabel_2 = uilabel(app.Panel_4);
app.ValueLabel_2.FontName = 'Times New Roman';
app.ValueLabel_2.FontSize = 16;
app.ValueLabel_2.FontWeight = 'bold';
app.ValueLabel_2.Position = [5 65 60 25];
app.ValueLabel_2.Text = 'Value';

% Create Load2Label
app.Load2Label = uilabel(app.Panel_4);
app.Load2Label.FontName = 'Times New Roman';
app.Load2Label.FontSize = 16;
app.Load2Label.FontWeight = 'bold';
app.Load2Label.Position = [5 95 60 25];
app.Load2Label.Text = 'Load-2';

% Create Drop_LoadType2
app.Drop_LoadType2 = uidropdown(app.Panel_4);
app.Drop_LoadType2.Items = {'None', 'Type 1', 'Type 2', 'Type 3', 'Type 4', 'Type 5', 'Type 6', 'Type 7'};
app.Drop_LoadType2.ValueChangedFcn = createCallbackFcn(app, @Drop_LoadType2ValueChanged, true);
app.Drop_LoadType2.FontName = 'Times New Roman';
app.Drop_LoadType2.FontWeight = 'bold';
app.Drop_LoadType2.FontColor = [0 0 1];
app.Drop_LoadType2.Position = [70 95 90 25];
app.Drop_LoadType2.Value = 'None';

% Create Field_Loada2
app.Field_Loada2 = uieditfield(app.Panel_4, 'numeric');
app.Field_Loada2.HorizontalAlignment = 'center';
app.Field_Loada2.FontColor = [0 0 1];
app.Field_Loada2.Position = [70 35 90 25];

% Create aLabel_2
app.aLabel_2 = uilabel(app.Panel_4);
app.aLabel_2.FontName = 'Times New Roman';
app.aLabel_2.FontSize = 16;
app.aLabel_2.FontWeight = 'bold';
app.aLabel_2.Position = [5 35 60 25];
app.aLabel_2.Text = 'a';

% Create ReleasesLabel
app.ReleasesLabel = uilabel(app.Panel_4);
app.ReleasesLabel.FontName = 'Times New Roman';
app.ReleasesLabel.FontSize = 16;
app.ReleasesLabel.FontWeight = 'bold';
app.ReleasesLabel.Position = [5 5 63 25];
app.ReleasesLabel.Text = 'Releases';

% Create Drop_Release
app.Drop_Release = uidropdown(app.Panel_4);
app.Drop_Release.Items = {'None', 'Start', 'End', 'Both'};
app.Drop_Release.FontName = 'Times New Roman';
app.Drop_Release.FontWeight = 'bold';
app.Drop_Release.FontColor = [0 0 1];
app.Drop_Release.Position = [70 5 90 25];
app.Drop_Release.Value = 'None';

% Create Panel_5
app.Panel_5 = uipanel(app.MembersTab);
app.Panel_5.AutoResizeChildren = 'off';
app.Panel_5.Position = [189 27 545 35];

% Create FromFileLabel_2
app.FromFileLabel_2 = uilabel(app.Panel_5);
app.FromFileLabel_2.FontName = 'Times New Roman';
app.FromFileLabel_2.FontSize = 16;
app.FromFileLabel_2.FontWeight = 'bold';
app.FromFileLabel_2.Position = [5 5 80 25];
app.FromFileLabel_2.Text = 'From File';

% Create BrowseButton_2
app.BrowseButton_2 = uibutton(app.Panel_5, 'push');
app.BrowseButton_2.ButtonPushedFcn = createCallbackFcn(app, @BrowseButton_2Pushed, true);
app.BrowseButton_2.FontName = 'Times';
app.BrowseButton_2.FontSize = 16;
app.BrowseButton_2.FontWeight = 'bold';
app.BrowseButton_2.Position = [450 5 90 25];
app.BrowseButton_2.Text = 'Browse';

% Create Field_FileName_2
app.Field_FileName_2 = uieditfield(app.Panel_5, 'text');
app.Field_FileName_2.Editable = 'off';
app.Field_FileName_2.HorizontalAlignment = 'right';
app.Field_FileName_2.FontName = 'Times New Roman';
app.Field_FileName_2.FontSize = 16;
app.Field_FileName_2.FontAngle = 'italic';
app.Field_FileName_2.Enable = 'off';
app.Field_FileName_2.Position = [80 5 365 25];

% Create AddMemberButton
app.AddMemberButton = uibutton(app.MembersTab, 'push');
app.AddMemberButton.ButtonPushedFcn = createCallbackFcn(app, @AddMemberButtonPushed, true);
app.AddMemberButton.WordWrap = 'on';
app.AddMemberButton.FontName = 'Times';
app.AddMemberButton.FontSize = 16;
app.AddMemberButton.FontWeight = 'bold';
app.AddMemberButton.Position = [475 68 80 50];
app.AddMemberButton.Text = 'Add Member';

% Create ModifyMemberButton
app.ModifyMemberButton = uibutton(app.MembersTab, 'push');
app.ModifyMemberButton.ButtonPushedFcn = createCallbackFcn(app, @ModifyMemberButtonPushed, true);
app.ModifyMemberButton.WordWrap = 'on';
app.ModifyMemberButton.FontName = 'Times';
app.ModifyMemberButton.FontSize = 16;
app.ModifyMemberButton.FontWeight = 'bold';
app.ModifyMemberButton.Position = [562 68 80 50];
app.ModifyMemberButton.Text = 'Modify Member';

% Create DeleteMemberButton
app.DeleteMemberButton = uibutton(app.MembersTab, 'push');
app.DeleteMemberButton.ButtonPushedFcn = createCallbackFcn(app, @DeleteMemberButtonPushed, true);
app.DeleteMemberButton.WordWrap = 'on';
app.DeleteMemberButton.FontName = 'Times';
app.DeleteMemberButton.FontSize = 16;
app.DeleteMemberButton.FontWeight = 'bold';
app.DeleteMemberButton.Position = [648 68 80 50];
app.DeleteMemberButton.Text = 'Delete Member';

% Create Button_Export_2
app.Button_Export_2 = uibutton(app.MembersTab, 'push');
app.Button_Export_2.ButtonPushedFcn = createCallbackFcn(app, @Button_Export_2Pushed, true);
app.Button_Export_2.Icon = 'ExportButton.png';
app.Button_Export_2.FontName = 'Times';
app.Button_Export_2.FontSize = 16;
app.Button_Export_2.FontWeight = 'bold';
app.Button_Export_2.Position = [189 68 50 50];
app.Button_Export_2.Text = '';

% Create LoadTypesTab
app.LoadTypesTab = uitab(app.TabGroup);
app.LoadTypesTab.Title = 'Load Types';

% Create Image
app.Image = uiimage(app.LoadTypesTab);
app.Image.ScaleMethod = 'stretch';
app.Image.Position = [1 1 738 400];
app.Image.ImageSource = 'FEM.png';

% Create CalculateTab
app.CalculateTab = uitab(app.TabGroup);
app.CalculateTab.Title = 'Calculate';

% Create AssembleButton
app.AssembleButton = uibutton(app.CalculateTab, 'push');
app.AssembleButton.ButtonPushedFcn = createCallbackFcn(app, @AssembleButtonPushed, true);
app.AssembleButton.WordWrap = 'on';
app.AssembleButton.FontName = 'Times';
app.AssembleButton.FontSize = 16;
app.AssembleButton.FontWeight = 'bold';
app.AssembleButton.Position = [8 340 160 50];
app.AssembleButton.Text = 'Assemble';

% Create EleminateButton
app.EleminateButton = uibutton(app.CalculateTab, 'push');
app.EleminateButton.ButtonPushedFcn = createCallbackFcn(app, @EleminateButtonPushed, true);
app.EleminateButton.WordWrap = 'on';
app.EleminateButton.FontName = 'Times';
app.EleminateButton.FontSize = 16;
app.EleminateButton.FontWeight = 'bold';
app.EleminateButton.Position = [10 281 160 50];
app.EleminateButton.Text = 'Eleminate';

% Create ArrangeButton
app.ArrangeButton = uibutton(app.CalculateTab, 'push');
app.ArrangeButton.ButtonPushedFcn = createCallbackFcn(app, @ArrangeButtonPushed, true);
app.ArrangeButton.WordWrap = 'on';
app.ArrangeButton.FontName = 'Times';
app.ArrangeButton.FontSize = 16;
app.ArrangeButton.FontWeight = 'bold';
app.ArrangeButton.Position = [8 221 160 50];
app.ArrangeButton.Text = 'Arrange';

% Create CondenseButton
app.CondenseButton = uibutton(app.CalculateTab, 'push');
app.CondenseButton.ButtonPushedFcn = createCallbackFcn(app, @CondenseButtonPushed, true);
app.CondenseButton.WordWrap = 'on';
app.CondenseButton.FontName = 'Times';
app.CondenseButton.FontSize = 16;
app.CondenseButton.FontWeight = 'bold';
app.CondenseButton.Position = [8 161 160 50];
app.CondenseButton.Text = 'Condense';

% Create SolveDOFButton
app.SolveDOFButton = uibutton(app.CalculateTab, 'push');
app.SolveDOFButton.ButtonPushedFcn = createCallbackFcn(app, @SolveDOFButtonPushed, true);
app.SolveDOFButton.WordWrap = 'on';
app.SolveDOFButton.FontName = 'Times';
app.SolveDOFButton.FontSize = 16;
app.SolveDOFButton.FontWeight = 'bold';
app.SolveDOFButton.Position = [8 101 160 50];
app.SolveDOFButton.Text = 'Solve DOF';

% Create Panel_6
app.Panel_6 = uipanel(app.CalculateTab);
app.Panel_6.AutoResizeChildren = 'off';
app.Panel_6.Position = [179 350 545 35];

% Create DirectoryLabel
app.DirectoryLabel = uilabel(app.Panel_6);
app.DirectoryLabel.FontName = 'Times New Roman';
app.DirectoryLabel.FontSize = 16;
app.DirectoryLabel.FontWeight = 'bold';
app.DirectoryLabel.Position = [5 5 80 25];
app.DirectoryLabel.Text = 'Directory';

% Create Field_FileDirectory
app.Field_FileDirectory = uieditfield(app.Panel_6, 'text');
app.Field_FileDirectory.Editable = 'off';
app.Field_FileDirectory.HorizontalAlignment = 'right';
app.Field_FileDirectory.FontName = 'Times New Roman';
app.Field_FileDirectory.FontSize = 16;
app.Field_FileDirectory.FontAngle = 'italic';
app.Field_FileDirectory.Enable = 'off';
app.Field_FileDirectory.Position = [80 5 456 25];

% Create SolveMembersButton
app.SolveMembersButton = uibutton(app.CalculateTab, 'push');
app.SolveMembersButton.ButtonPushedFcn = createCallbackFcn(app, @SolveMembersButtonPushed, true);
app.SolveMembersButton.WordWrap = 'on';
app.SolveMembersButton.FontName = 'Times';
app.SolveMembersButton.FontSize = 16;
app.SolveMembersButton.FontWeight = 'bold';
app.SolveMembersButton.Position = [8 41 160 50];
app.SolveMembersButton.Text = 'Solve Members';

% Show the figure after all components are created


app.Stiffness2DUIFigure.Visible = 'on';
end
end

% App creation and deletion


methods (Access = public)

% Construct app
function app = Stiffness2D_V3

% Create UIFigure and components


createComponents(app)

% Register the app with App Designer


registerApp(app, app.Stiffness2DUIFigure)

% Execute the startup function


runStartupFcn(app, @startupFcn)

if nargout == 0
clear app
end
end

% Code that executes before app deletion


function delete(app)

% Delete UIFigure when app is deleted


delete(app.Stiffness2DUIFigure)
end
end
end

You might also like