<?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>Spreadsheet Example VI</name>
  <metadata>
  <md:version>**new**</md:version>
  <md:created>2004/06/21 13:49:53.455 GMT-5</md:created>
  <md:revised>2004/06/21 13:53:08.600 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="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="lizzardg">
      <md:firstname>Elizabeth</md:firstname>
      
      <md:surname>Gregory</md:surname>
      <md:email>lizzardg@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>spreadsheet</md:keyword>
  </md:keywordlist>

  <md:abstract>In this exercise, the objective is to save a 2D array in a text file so a spreadsheet application can access the file and to display numeric data in a table. Complete the following steps to examine a VI that saves numeric arrays to a file in a format you can access with a spreadsheet.
</md:abstract>
</metadata>
  <!--When CNXML 0.6 comes out, this module will need to be revised to
  include para in the items indicated.-->
  <content>
    <exercise id="e1">
      <problem>
	<section id="s1">
	  <name>Front Panel</name>
	  <list id="s1l1" type="enumerated">
	    <item>
	      Open the <code>Spreadsheet Example</code> VI located in
	      the <code>C:\Exercises\LabVIEW Basics I</code>
	      directory. The front panel in <cnxn target="s1l1f1"/> is
	      already built.
	      <figure id="s1l1f1">
		<media type="image/png" src="spreadex.png"/>
	      </figure>
	    </item>
	  </list>
	</section>
	<section id="s2">
	  <name>Run the VI</name>
	  <list id="s2l1" type="enumerated">
	    <item><!--needs para-->
	      <!--para-->
	      Run the VI.
	      <!--para-->
	      The VI generates a 2D array of 
	      <m:math>
		<m:apply>
		  <m:cartesianproduct/>
		  <m:apply>
		    <m:times/>
		    <m:cn>128</m:cn>
		    <m:ci>rows</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:times/>
		    <m:cn>3</m:cn>
		    <m:ci>columns</m:ci>
		  </m:apply>
		</m:apply>
	      </m:math>. The first column contains data for a sine
	      waveform, the second column contains data for a noise
	      waveform, and the third column contains data for a
	      cosine waveform. The VI plots each column in a graph and
	      displays the data in a table.
	    </item>
	    <item>
	      When the <code>Choose file to write</code> dialog box
	      appears, save the file as <code>wave.txt</code> in the
	      <code>C:\Exercises\LabVIEW Basics I</code> directory and
	      click the <code>OK</code> button. Later, you will
	      examine this file.
	    </item>
	  </list>
	</section>
	<section id="s3">
	  <name>Block Diagram</name>
	  <list id="s3l1" type="enumerated">
	    <item>
	      Display and examine the <cnxn target="s3l1f1">block
	      diagram</cnxn> for this VI.
	      <figure id="s3l1f1">
		<media type="image/png" src="spreadexbd.png"/>
	      </figure>
	      <list id="s3l1l1">
		<item>
		    <media type="image/png" src="sinepaticon.png"/>
		  The <code>Sine Pattern</code> VI
		  located on the <code>Functions&gt;&gt;All
		  Functions&gt;&gt;Analyze&gt;&gt;Signal Processing&gt;&gt;Signal
		  Generation</code> palette returns a numeric array of
		  128 elements containing a sine pattern. The constant
		  <code>90.0</code>, in the second instance of the
		  <code>Sine Pattern</code> VI, specifies the phase of
		  the sine pattern or cosine pattern.
		</item>
		<item>
		    <media type="image/png" src="uniform.png"/>
		  The <code>Uniform White Noise</code>
		  VI located on the <code>Functions&gt;&gt;All
		  Functions&gt;&gt;Analyze&gt;&gt;Signal Processing&gt;&gt;Signal
		  Generation</code> palette returns a numeric array of
		  128 elements containing a noise pattern.
		</item>
		<item>
		    <media type="image/png" src="BuildArrayicon.png"/>
		  The <code>Build Array</code>
		  function located on the <code>Functions&gt;&gt;All
		  Functions&gt;&gt;Array</code> palette builds the 2D array
		  from the sine array, noise array, and cosine array,
		  as shown in <cnxn target="s3l1l1f4"/>.
		  <figure id="s3l1l1f4">
		    <media type="image/png" src="BuildArray.png"/>
		  </figure>
		</item>
		<item>
		    <media type="image/png" src="trans2daryicon.png"/>
		  The <code>Transpose 2D
		  Array</code> function located on the
		  <code>Functions&gt;&gt;All Functions&gt;&gt;Array</code> palette
		  rearranges the elements of the 2D array so element
		  <m:math>
		    <m:set>
		      <m:ci>i</m:ci>
		      <m:ci>j</m:ci>
		    </m:set>
		  </m:math> becomes element 
		  <m:math>
		    <m:set>
		      <m:ci>j</m:ci>
		      <m:ci>i</m:ci>
		    </m:set>
		  </m:math>, as in <cnxn target="s3l1l1f6"/>.
		  <figure id="s3l1l1f6">
		    <media type="image/png" src="transarry.png"/>
		  </figure>
		</item>
		<item>
		    <media type="image/png" src="wrtspreadfileicon.png"/>
		  The <code>Write To Spreadsheet
		  File</code> VI located on the <code>Functions&gt;&gt;All
		  Functions&gt;&gt;File I/O</code> palette formats the 2D
		  array into a spreadsheet string and writes the
		  string to a file. The string has the format shown in
		  <cnxn target="s3l1l1f8"/>, where an arrow indicates
		  a tab, and a paragraph symbol (¶) indicates an
		  end of line character.  
		  <figure id="s3l1l1f8">
		    <media type="image/png" src="writespread.png"/>
		  </figure>
		</item>
		<item>
		    <media type="image/png" src="num2fracstrgicon.png"/> The <code>Number To
		  Fractional String</code> function located on the
		  <code>Functions&gt;&gt;All
		  Functions&gt;&gt;String&gt;&gt;String/Number Conversion</code>
		  palette converts an array of numeric values to an
		  array of strings that the table displays.
		</item>
	      </list>
	    </item>
	    <item>
	      Close the VI. Do not save changes.
	      <note>
		This example stores only three arrays in the file. To
		include more arrays, increase the number of inputs to
		the <code>Build Array</code> function.
	      </note>
	    </item>
	  </list>
	</section>
	<section id="s4">
	  <name>Optional</name>
	  <para id="s4p1">
	    Open the <code>wave.txt</code> file using a word processor
	    or spreadsheet application and view its contents.
	  </para>
	  <list id="s4l1" type="enumerated">
	    <item>
	      Open a word processor or spreadsheet application, such
	      as (<emphasis>Windows</emphasis>) Notepad or WordPad,
	      (<emphasis>Mac OS</emphasis>) SimpleText, or
	      (<emphasis>UNIX</emphasis>) Text Editor.
	    </item>
	    <item>
	      Open <code>wave.txt</code>. The sine waveform data
	      appear in the first column, the random waveform data
	      appear in the second column, and the cosine waveform
	      data appear in the third column.
	    </item>
	    <item>
	      Exit the word processor or spreadsheet application and
	      return to LabVIEW.
	    </item>
	  </list>
	</section>
      </problem>
    </exercise>


  </content> 

</document>
