imat_ctrace/and


Purpose

Return intersection of two coordinate traces.

Syntax

t=t1&t2

[t,i1,i2]=and(t1,t2)

Description

AND returns intersection of two coordinate traces. The resulting coordinate trace will have all coordinates which are included in both arguments, in sorted order. (Note that positive and negative directions are considered distinct.) The resultant coordinate trace will retain the name of the first coordinate trace passed in.

The second format also returns index arrays i1 and i2 such that t=t1(i1)=t2(i2). This form can be useful when the order of the coordinates in the original arrays is important.

Examples

>> t1=imat_ctrace('5y', '6rx', '3z', '4x-')

t1 =

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

>> t2=imat_ctrace('4x', '3z', '2z-', '5y', '8x+')

t2 =

    '4X+'
    '3Z+'
    '2Z-'
    '5Y+'
    '8X+'

>> t1&t2

ans =

    '3Z+'
    '5Y+'

>>

See Also

imat_ctrace/or, imat_ctrace/unique