<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN" "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="None">
  <name>Polymorphism</name>
  <metadata>
  <md:version>1.3</md:version>
  <md:created>2004/06/18 11:33:26 GMT-5</md:created>
  <md:revised>2007/07/19 10:03:37.529 GMT-5</md:revised>
  <md:authorlist>
      <md:author id="NationalInstruments">
      <md:firstname>National</md:firstname>
      
      <md:surname>Instruments</md:surname>
      <md:email>certification@ni.com</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist>
    <md:maintainer id="NationalInstruments">
      <md:firstname>National</md:firstname>
      
      <md:surname>Instruments</md:surname>
      <md:email>certification@ni.com</md:email>
    </md:maintainer>
    <md:maintainer id="lizzardg">
      <md:firstname>Elizabeth</md:firstname>
      
      <md:surname>Gregory</md:surname>
      <md:email>elizabeth.gregory@gmail.com</md:email>
    </md:maintainer>
    <md:maintainer id="mshiralkar05">
      <md:firstname>Malan</md:firstname>
      
      <md:surname>Shiralkar</md:surname>
      <md:email>mshiralkar05@hotmail.com</md:email>
    </md:maintainer>
    <md:maintainer id="harika">
      <md:firstname>Harika</md:firstname>
      
      <md:surname>Basana</md:surname>
      <md:email>ilsai@rice.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist>
    <md:keyword>LabVIEW</md:keyword>
    <md:keyword>National Instruments</md:keyword>
    <md:keyword>Polymorphism</md:keyword>
    <md:keyword>polymorphism</md:keyword>
  </md:keywordlist>

  <md:abstract>In this section, you will learn about Polymorphism.</md:abstract>
</metadata>
  
  <content>
    <para id="para1">The <code>Numeric</code> functions located on the
      <code>Functions&gt;&gt;Express Numeric</code> and <code>Functions&gt;&gt;All
      Functions&gt;&gt;Numeric</code> palettes are polymorphic. This means
      that the inputs to these functions can be different data
      structures, such as scalar values and arrays. For example, you
      can use the <code>Add</code> function to add a scalar value to
      an array or to add two arrays together. If you wire a scalar
      value of <m:math><m:cn>2</m:cn></m:math> and the <!--<cnxn target="table1">-->following array<!--</cnxn>--> to the <code>Add</code>
      function.
    </para>
    <table frame="all" id="table1">
      <tgroup cols="3" align="center">
	<tbody valign="top">
	  <row>
	    <entry>1</entry>
	    <entry>3</entry>
	    <entry>2</entry>
	  </row>
	</tbody>
      </tgroup>
    </table> 
    <para id="para2">The function adds the scalar value to each element of the array
      and returns the <!--<cnxn target="table2">-->following array<!--</cnxn>-->:
    </para>
    <table frame="all" id="table2">
      <tgroup cols="3" align="center">
	<tbody valign="top">
	  <row>
	    <entry>3</entry>
	    <entry>5</entry>
	    <entry>4</entry>
	  </row>
	</tbody>
      </tgroup>
    </table> 
    <para id="para3">If you wire the previous two arrays <!--(<cnxn target="table1"/> and
      <cnxn target="table2"/>)--> to the <code>Add</code> function, the
      function adds each element of one array to the corresponding
      element of the other array and returns the <!--<cnxn target="tabel3">-->following array<!--</cnxn>-->:
    </para>
    <table frame="all" id="table3">
      <tgroup cols="3" align="center">
	<tbody valign="top">
	  <row>
	    <entry>4</entry>
	    <entry>8</entry>
	    <entry>6</entry>
	  </row>
	</tbody>
      </tgroup>
    </table>
    <para id="para4">Wire two arrays of different sizes to the <code>Add</code>
      function, such as the <!--<cnxn target="table3">-->previous
      array<!--</cnxn>--> and the <!--<cnxn target="table4">-->following
      array<!--</cnxn>-->:
    </para>
    <table frame="all" id="table4">
      <tgroup cols="3" align="center">
	<tbody valign="top">
	  <row>
	    <entry>3</entry>
	    <entry>1</entry>
	    <entry>2</entry>
	    <entry>3</entry>
	  </row>
	</tbody>
      </tgroup>
    </table>
    <para id="para5">The function adds corresponding elements and returns the <!--<cnxn target="table5">-->following array<!--</cnxn>-->, which is the size of the
      smaller input array:
    </para>
    <table frame="all" id="table5">
      <tgroup cols="3" align="center">
	<tbody valign="top">
	  <row>
	    <entry>7</entry>
	    <entry>9</entry>
	    <entry>8</entry>
	  </row>
	</tbody>
      </tgroup>
    </table>
    <para id="para6">
      You use the <code>Numeric</code> functions with
      <code>clusters</code> the same way you use them with arrays of
      numeric values. Refer to <cnxn document="m12227">Clusters</cnxn> for
      more information about clusters.
    </para>
  </content>
  
</document>
