<?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>Making Decisions with the Select Function</name>
  <metadata>
  <md:version>1.1</md:version>
  <md:created>2004/06/23 10:38:24 GMT-5</md:created>
  <md:revised>2004/07/16 15:18:55.542 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>decision</md:keyword>
    <md:keyword>select</md:keyword>
  </md:keywordlist>

  <md:abstract>In this lesson, you will learn about making decisions with the Select function.</md:abstract>
</metadata>

  <content>
    <para id="p1">
      Every VI described in this course so far has executed in an
      order dependent on the flow of data. There are cases when a
      decision must be made in a program. For example, if
      <emphasis>a</emphasis> happens, do <emphasis>b</emphasis>; else
      if <emphasis>c</emphasis> happens, do <emphasis>d</emphasis>.
    </para>
    <para id="p2">
      In text-based programs, this can be accomplished with if-else
      statements, case statements, switch statements, and so
      on. LabVIEW includes many different ways of making
      decisions. The simplest of these methods is the
      <code>Select</code> function.
    </para>
    <section id="s1">
      <name>Select Function</name>
      
      <para id="s1p1">
      
	<media type="image/png" src="selecttherm.png"/>
	The <code>Select</code> function, located on the
	<code>Functions&gt;&gt;Express Comparison</code> palette, selects
	between two values dependent on a Boolean input. If the
	Boolean input <code>s</code> is <code>True</code>, this
	function returns the value wired to the <code>t</code>
	input. If the Boolean input is <code>False</code>, this
	function returns the value wired to the <code>f</code> input.
      </para>
      <para id="s1p2">
	You used the <code>Select</code> function in the <cnxn document="m12209">Thermometer VI</cnxn> exercise to determine
	whether to output a Fahrenheit value or a Celsius value, as
	shown in the block diagram in <cnxn target="s1f2"/>.
      </para>
      <figure id="s1f2">
	<media type="image/png" src="thermbd.png"/>
      </figure>
      <para id="s1p3">
	If the decision to be made is more complex than a
	<code>Select</code> function can execute, a <code>Case</code>
	structure may be required.
      </para>
    </section>

  </content>
  
</document>
