<?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>Array Exercise VI</name>
  <metadata>
  <md:version>**new**</md:version>
  <md:created>2004/06/18 13:16:51.431 GMT-5</md:created>
  <md:revised>2004/06/28 15:38:40.909 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="lizzardg">
      <md:firstname>Elizabeth</md:firstname>
      
      <md:surname>Gregory</md:surname>
      <md:email>lizzardg@rice.edu</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:maintainer id="NationalInstruments">
      <md:firstname>National</md:firstname>
      
      <md:surname>Instruments</md:surname>
      <md:email>certification@ni.com</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist>
    <md:keyword>National Instruments</md:keyword>
    <md:keyword>LabVIEW</md:keyword>
    <md:keyword>exercise</md:keyword>
    <md:keyword>Array Exercise VI</md:keyword>
  </md:keywordlist>

  <md:abstract>Create arrays and become familiar with the Array functions.</md:abstract>
</metadata>
  
  <content>
    <exercise id="e1">
      <problem>
	<para id="para1">
	  Complete the following steps to build a VI that creates an array of
	  random numbers, scales the resulting array, and takes a subset
	  of that final array.
	</para> 
	<section id="section1">
	  <name>Front Panel</name>
	  <list id="list1" type="enumerated">
	    <item>
	      Open a blank VI and build the front panel shown in <cnxn target="f1"/>.
	      <figure id="f1">
		<media type="image/png" src="arrex.png"/>
	      </figure>
	      <list id="list2" type="enumerated">
		<item>      
		  Place an <code>array</code>, located on the
		  <code>Controls&gt;&gt;All Controls&gt;&gt;Array &amp; Cluster</code>
		  palette, on the front panel.
		</item>
		<item>      
		  Label the array <code>Random Array</code>.
		</item>
		<item> 
		  Place a <code>numeric indicator</code>, located on the
		  <code>Controls&gt;&gt;Numeric Indicators</code> palette, in
		  the <code>array</code> shell.
		</item>
		<item>   
		  Use the <code>Positioning</code> tool to resize the
		  array control to contain
		  <m:math><m:cn>10</m:cn></m:math> <code>numeric
		    indicators</code>.
		</item>
		<item>  
		  Press the <code>&lt;Ctrl&gt;</code> key while you click and
		  drag the <code>Random Array</code> control to create two
		  copies of the control.
		</item>
		<item>    
		  Label the copies <code>Final Array</code> and
		  <code>Subset Array</code>.
		</item>
		<item>      
		  Place three <code>numeric controls</code>, located on
		  the <code>Controls&gt;&gt;Numeric Controls</code> palette, and
		  label them <code>Scaling Factor</code>, <code>Start
		    Subset</code>, and <code># of Elements</code>.
		</item>
		<item>      
		  Right-click the <code>Start Subset</code> and <code># of
		    Elements</code> controls and select
		  <code>Representation&gt;&gt;I32</code> from the shortcut menu.
		</item>
		<item>      
		  Do not change the values of the front panel controls.
		</item>
	      </list>
	    </item>
	  </list>
	</section>
	<section id="section2">
	  <name>Block Diagram</name>
	  <list id="list3" type="enumerated">
	    <item>
	      Build the block diagram shown in <cnxn target="f2"/>.
	      <figure id="f2">
		<media type="image/png" src="arrexbd.png"/>
	      </figure>
	      <list id="list4" type="enumerated">
		<item>     
		  <media type="image/png" src="randnum.png"/>
		  Place the <code>Random Number (0-1)</code> function,
		  located on the <code>Functions&gt;&gt;Arithmetic &amp;
		    Comparison&gt;&gt;Express Numeric</code> palette, on the block
		  diagram. This function generates a random number between
		  <m:math><m:cn>0</m:cn></m:math> and
		  <m:math><m:cn>1</m:cn></m:math>.
		</item>
		<item>
		  <media type="image/png" src="forloop.png"/>
		  Place the <code>For Loop</code>, located on the
		  <code>Functions&gt;&gt;All Functions&gt;&gt;Structures</code>
		  palette, on the block diagram. The loop accumulates an
		  array of <m:math><m:cn>10</m:cn></m:math> random numbers
		  at the output tunnel. Create a constant of
		  <m:math><m:cn>10</m:cn></m:math> for the count terminal.
		</item>
		<item>
		  <media type="image/png" src="multiply.png"/>
		  Place the <code>Multiply</code> function, located on the
		  <code>Functions&gt;&gt;Arithmetic &amp; Comparison&gt;&gt;Express
		    Numeric</code> palette, on the block diagram. In this
		  exercise this function multiplies <code>Random
		    Array</code> by <code>Scaling Factor</code> and returns
		  <code>Final Array</code>.
		</item>
		<item>
		  <media type="image/png" src="ArraySubset.png"/>
		  Place the Array Subset function, located on the
		  <code>Functions&gt;&gt;All Functions&gt;&gt;Array</code> palette, on
		  the block diagram. This function returns a portion of an
		  array starting at <code>Start Subset</code> and
		  containing <code># of Elements</code> elements.
		</item>
	      </list>
	    </item>
	    <item>
	      Save the VI as <code>Array Exercise.vi</code> in the
	      <code>C:\Exercises\ LabVIEW Basics I</code> directory.
	    </item>
	  </list>
	</section>
	<section id="section3">
	  <name>Run the VI</name>
	  <list id="list5" type="enumerated">
	    <item>
	      <!--needs to be corrected, should be seperate paragraphs-->
	      Display the front panel, change the values of the controls,
	      and run the VI a few times.
	      <!--different para-->

	      The <code>For Loop</code> runs for
	      <m:math><m:cn>10</m:cn></m:math> iterations. Each iteration
	      generates a random number and stores it at the output
	      tunnel. <code>Random Array</code> displays an array of
	      <m:math><m:cn>10</m:cn></m:math> random numbers. The VI
	      multiplies each value in <code>Random Array</code> by
	      <code>Scaling Factor</code> to create <code>Final
		Array</code>. The VI takes a subset of <code>Final
		Array</code> starting at <code>Start Subset</code> for
	      <code># of Elements</code> and displays the subset in
	      <code>Subset Array</code>.
	    </item>
	    <item>
	      Close the VI.
	    </item>
	  </list>
	</section>
      </problem>
    </exercise>
  </content>
  
</document>
