Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Structures are a convenient way to organize data. To demonstrate how structures work, consider the triangular element below with three nodes, one at each corner.

Image Added
For this element, the strain and stress are constant over the element. Thus, the element has three components each of strain and stress associated with it as shown below.
Image Added

Image Added

There are many ways one can store this information. One simple but elegant way to do this would be to create a data structure that has two data containers (or fields) as shown below. The first field contains the three strain components and is labeled eps. The second field contains the three stress components and is labeled sig. We label the data structure sigepsstruct. All these labels are consistent with redAnTS.

Image Added
 
In the above representation, sigepsstruct is refered to as a structure with two fields: eps and sig. A useful way to visualize this is that sigepsstruct is a box that contains two smaller boxes, eps and sig, which hold the strain and stress values, respectively. So if I want, say, the stress values, I ask MATLAB to open the sig box within sigepsstruct and look inside.

Image Added
 

Create a structure

Let's create the above structure in MATLAB. Start MATLAB. Create a working directory at an appropriate location using the Current Directory window. If you cannot see this window, select Main Menu > Desktop > Current Directory. You can right-click in this window to access the option for creating a new folder (i.e. directory). Browse to this folder to make this your working directory.

...