imat_ctrace/unique


Purpose

Sort coordinate trace and remove repeated coordinates.

Syntax

[tsort,i,q]=unique(t)

Description

When applied to an imat_ctrace object, the UNIQUE function sorts a coordinate trace in order of node, then degree of freedom, and eliminates duplicate coordinates. Plus and minus coordinates are considered different.

The (optional) second output argument is an index array such that tsort=t(i).

The (optional) third output argument is a logical array Q of size T containing true for the selected unique coordinates.

Rotational degrees of freedom are sorted to follow the translational degrees of freedom. Repeated coordinates are not eliminated, but plus coordinates sort before minus coordinates if the coordinates match in other respects.

Starting in MATLAB R2013a, the behavior of UNIQUE has changed. To preserve the behavior of previous versions of MATLAB, pass in the string 'legacy'.

Examples

>> t=imat_ctrace('5y', '3rx', '3z', '4x-', '3z', '5y+')

t =

    '5Y+'
    '3RX+'
    '3Z+'
    '4X-'
    '3Z+'
    '5Y+'

>> unique(t)

ans =

    '3Z+'
    '3RX+'
    '4X-'
    '5Y+'

>> [ts,i]=unique(t);    i

i =

     5
     2
     4
     6

>>

See Also

imat_ctrace/sort