Coordinate Traces


A coordinate trace is simply an ordered list of coordinates. Each individual coordinate in the trace consists of a node number followed by a four-character direction string. Examples of coordinates include 101X+, 1234RY-, and 12ABC. In most cases, the direction string will be X, Y, Z, RX, RY, or RZ, followed by a plus or minus sign. These directions refer to the local coordinates in which the nodal displacements are resolved. (There are cases such as acoustic measurements when a more general direction string is used.)

Coordinate traces are used in IMAT to perform selection operations on functions and shapes. This section of the user's guide shows how to manipulate coordinate traces.

Data Format for Coordinate Traces

The IMAT Toolbox includes a data class (imat_ctrace) for coordinate traces. These objects are much simpler than either imat_fn or imat_shp objects, as there are only a few attributes associated with a coordinate trace. You should think of an imat_ctrace object as an Nx1 array of coordinate strings.

You can create a coordinate trace by passing coordinate strings to the imat_ctrace constructor function:

>> t=imat_ctrace('1001x','1001y-','1001z')

t =
    '1001X+'
    '1001Y-'
    '1001Z+'

>>

Note that positive signs are assumed if you do not enter them. There is no such thing as a multidimensional coordinate trace; each coordinate trace variable is a single list of coordinates.

The attributes currently associated with an imat_ctrace object is its name, a description of its contents, and an internal structure version number. The name and description are both strings. The version number is for internal use, so you should not need to use it. You can assign or extract the name by using the 'dot' nomenclature, as shown in the following example, or by using the get and set functions. If the imat_ctrace object has a name assigned to it, the name will be displayed when the coordinate trace is displayed. If it is empty, it will not be displayed (as in the example above).

>> t=imat_ctrace('1001x','1001y-','1001z');
>> t.name='Coordinate trace'

Coordinate trace
t =

    '1001X+'
    '1001Y-'
    '1001Z+'

>> t.name

ans =
Coordinate trace

>> get(t,'name')

ans =

Coordinate trace

>>

The imat_ctrace function reference describes other ways of creating a coordinate trace.

 

Manipulating Coordinate Traces

You can access individual coordinates in a coordinate trace, or a subset of a coordinate trace, using normal indexing. For example, t(2) refers to the second coordinate in the list. You can also modify individual elements of a coordinate trace:

>> t(1)=t(3);
>> t(2)='1002rx';

Concatenating coordinate traces works the same as for vectors. For example, [t1;t2] creates a coordinate trace with the coordinates in t1 followed by the coordinate in t2. (Actually, [t1 t2] would create the same result, since coordinate traces can have only one column.)

There are other ways to combine multiple coordinate traces:

You can also sort coordinate traces and keep only unique coordinates (i.e., eliminate duplicates).

For more complicated manipulations, it may be useful to convert a coordinate trace into a numeric or string format. The following options are available:

Any of these forms can be manipulated in MATLAB, and the results passed back to the imat_ctrace constructor function to create a new coordinate trace. (The numeric direction codes created by the double function can be converted back to strings using the imat_num2dir function.) Strings passed into the imat_ctrace constructor should be converted to a cell array first. For example:

>> t=imat_ctrace('1001x','1002rz-','101z')

t =

'1001X+'
'1002RZ-'
'101Z+'

>> d=double(t)

d =

1001           1
1002          -6
101            3

>> t2=imat_ctrace(d)

t2 =

    '1001X+'
    '1002RZ-'
    '101Z+'

>> c=char(t)

c =

1001X+
1002RZ-
101Z+

>> t2=imat_ctrace(cellstr(c))      % Turn character array into cell array first

t2 =

    '1001X+'
    '1002RZ-'
    '101Z+'

>> whos

Name      Size         Bytes  Class
c         3x7             42  char array
d         3x2             48  double array
t         3x1            244  imat_ctrace object
t2        3x1            244  imat_ctrace object
Grand total is 59 elements using 578 bytes

>>

Other conversion functions include the following:


Finally, you can extract the signs of the coordinate directions using the sign function. To make all coordinates positive, the abs function works on coordinate traces.

Using coordinate traces with other IMAT data types

Coordinate traces are only marginally useful on their own. However, they find a lot of use when used with other IMAT objects such as functions and shapes. For example, they can be used to extract functions matching the DOF in the coordinate trace. You can read more about using coordinate traces with functions here. You can also use them to extract shape coefficients and subscript into and partition results.


Previous

Next