<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
<MAN>
  <LANGUAGE>eng</LANGUAGE>
  <TITLE>union</TITLE>
  <TYPE>Scilab Function</TYPE>
  <DATE>April 1999</DATE>
  <SHORT_DESCRIPTION name="union"> extract union components of a vector</SHORT_DESCRIPTION>
  <CALLING_SEQUENCE>
    <CALLING_SEQUENCE_ITEM>[v, [ka,kb]]=union(a,b)  </CALLING_SEQUENCE_ITEM>
    <CALLING_SEQUENCE_ITEM>  </CALLING_SEQUENCE_ITEM>
  </CALLING_SEQUENCE>
  <PARAM>
    <PARAM_INDENT>
      <PARAM_ITEM>
        <PARAM_NAME>a</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: vector of real numbers or strings</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>b</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: vector of real numbers or strings</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>v</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: row vector  of real numbers or strings</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>ka</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: row vector  of integers</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
      <PARAM_ITEM>
        <PARAM_NAME>kb</PARAM_NAME>
        <PARAM_DESCRIPTION>
          <SP>: row vector  of integers</SP>
        </PARAM_DESCRIPTION>
      </PARAM_ITEM>
    </PARAM_INDENT>
  </PARAM>
  <DESCRIPTION>
    <P><VERB>union(a,b)</VERB> returns a sorted row vector which retains the unique entries
    of <VERB>[a(:);b(:)]</VERB>.</P>
    <P><VERB>[v,ka,kb]=union(a,b)</VERB> also returns index vectors <VERB>ka</VERB> and
    <VERB>kb</VERB> such that <VERB>v</VERB> is a sorted combination of the entries
    <VERB>a(ka)</VERB> and <VERB>b(kb)</VERB>.</P>
  </DESCRIPTION>
  <EXAMPLE>
<![CDATA[
A=round(5*rand(10,1));
B=round(5*rand(7,1));

union(A,B)
[N,ka,kb]=union(A,B)

union('a'+string(A),'b'+string(B))

 ]]>
  </EXAMPLE>
  <SEE_ALSO>
    <SEE_ALSO_ITEM>
      <LINK>unique</LINK>
    </SEE_ALSO_ITEM>
    <SEE_ALSO_ITEM>
      <LINK>sort</LINK>
    </SEE_ALSO_ITEM>
  </SEE_ALSO>
</MAN>
