7 Auto Indexing,Clusters and Typedefs

download 7 Auto Indexing,Clusters and Typedefs

of 28

Transcript of 7 Auto Indexing,Clusters and Typedefs

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    1/28

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    2/28

    2

    Auto-indexing

    Auto-indexing

    Tunnel

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    3/28

    3

    Auto-indexing

    Wire an array to or from a loop, the tunnel can be

    changed to enable auto-indexing

    To pop the elements of array one by one out of theinput terminal or push the elements one by one into

    the output terminal.

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    4/28

    4

    Auto-indexing Input

    Control the number of iterations of a for-loop with Auto-

    indexing(Number of iteration=array size)

    Take the smallest number of elements if there is more than one array

    Number of iterations of While loop is not affected by the number of

    elements in the array eventhough auto-indexing is enabled.

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    5/28

    5

    Auto-Indexing

    Default for For Loop when we are connecting an

    array to the For Loop will be an auto-indexed

    tunnel. Default for While Loop when we are connecting

    an array to the While Loop will be a normal

    tunnel.

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    6/28

    6

    Auto-indexing Output

    Auto-indexed output arrays size = Number of iterations

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    7/287

    Exercise

    Creating An array of 8 Random Integers from 1to 10 Use auto-indexing to iterate a For Loop for 8 times.(Hint: random number VI located in Numeric Functions palette)

    Generates a random double precision floating point number0, and

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    8/288

    Demonstration

    Auto-indexing.vi

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    9/289

    Arrays Creating & Initializing 2D Arrays

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    10/2810

    Clusters

    Group mixed type data elements

    Similar to a record/struct in text-based programming

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    11/2811

    B. Clusters Cluster Creation & Constants

    Similar to Array

    Use Cluster VIs

    DEMONSTRATION

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    12/2812

    B. Clusters Order

    Cluster elements have a logical

    order unrelated to their position

    in the shell

    View and modify the cluster

    order:

    Right-clicking the cluster border

    selecting Reorder Controls

    In Cluster

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    13/2813

    B. Clusters Assembling a Cluster

    Use the Bundle function from cluster functions

    palette to assemble a new cluster

    DEMONSTRATION

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    14/28

    14

    B. Clusters Disassembling a Cluster

    Use the Unbundle By Name or Unbundle function

    to use individual items in a cluster

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    15/28

    15

    B. Clusters Modifying a Cluster

    Use the Bundle By Name or the Bundle function to

    modify an existing cluster

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    16/28

    16

    Demonstration

    Learn how to use Bundle/Unbundle/Unbundle By

    Name

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    17/28

    17

    Clusters Error Clusters

    LabVIEW uses error clusters to pass errorinformation

    An error cluster contains the following elements:

    status: Boolean value that reports True if an error occurs

    code: 32-bit signed integer that identifies the error

    source: String that identifies where the error occurred

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    18/28

    18

    Extras:

    Disable automatic error handling by go to

    (Tools-Option-Block Diagram-Error Handling) to

    uncheck the automatic error handling.

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    19/28

    19

    Demonstration

    Cluster.vi

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    20/28

    20

    C. Custom Control

    Customize the control/indicator by adding picture into

    it and etc

    Use the Control Editor window to customize controlsand indicators:

    Right-click a control/indicator

    AdvancedCustomize

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    21/28

    21

    C. Custom Control-Types

    Control:

    If edit, its instances not affected

    Type Definition:

    If edit, it will update all its instances

    (only data type changes are updated)

    Strict Type Definition

    If edit, it will update all its instances

    (all changes are updated except label, description &

    default value)

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    22/28

    22

    Demonstration

    Custom Control.vi

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    23/28

    23

    Quiz

    What is the result of the following Array

    subtraction?

    a. A 1-D array of {-25,25,50}

    b. A 1-D array of {-25,25}

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    24/28

    24

    Quiz

    What is the output value of the result?

    a. 1-D array of {2,3,4,5}

    b. 1-D array of {2}

  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    25/28

    25

    Links

    Join the NI Community:

    http://decibel.ni.com/content/index.jspa

    Then join groups:

    http://decibel.ni.com/content/groups/loop

    http://decibel.ni.com/content/groups/mmu-labview

    http://decibel.ni.com/content/groups/labview-career-network

    http://decibel.ni.com/content/index.jspahttp://decibel.ni.com/content/groups/loophttp://decibel.ni.com/content/groups/mmu-labviewhttp://decibel.ni.com/content/groups/labview-career-networkhttp://decibel.ni.com/content/groups/labview-career-networkhttp://decibel.ni.com/content/groups/labview-career-networkhttp://decibel.ni.com/content/groups/labview-career-networkhttp://decibel.ni.com/content/groups/labview-career-networkhttp://decibel.ni.com/content/groups/labview-career-networkhttp://decibel.ni.com/content/groups/labview-career-networkhttp://decibel.ni.com/content/groups/mmu-labviewhttp://decibel.ni.com/content/groups/mmu-labviewhttp://decibel.ni.com/content/groups/mmu-labviewhttp://decibel.ni.com/content/groups/loophttp://decibel.ni.com/content/index.jspa
  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    26/28

    26

    LabVIEW Student Design Competition:

    http://www.ni.com/studentdesign

    Win cash prizes

    Win a trip to Austin, US to attend NIWeek

    http://www.ni.com/studentdesignhttp://www.ni.com/studentdesign
  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    27/28

    27

    Links(Facebook)

    http://www.facebook.com/labviewu?sk=wall

    http://www.facebook.com/NIWeek

    http://www.facebook.com/labviewu?sk=wallhttp://www.facebook.com/NIWeekhttp://www.facebook.com/NIWeekhttp://www.facebook.com/labviewu?sk=wall
  • 8/3/2019 7 Auto Indexing,Clusters and Typedefs

    28/28

    Contact

    Tan Han Hui

    LabVIEW Student Ambassador

    MMU, Cyberjaya

    +6012-4796866

    [email protected]

    mailto:[email protected]:[email protected]