EET 2259 Unit 9 Arrays Read Bishop, Sections 6.1 to 6.3.

Slides:



Advertisements
Similar presentations
Previously… We created a simulated temperature reader which alerts if too hot or too cold… Download the solved practice to keep in sync: Thermostat.vi.
Advertisements

Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 2 Virtual Instruments Read Bishop, Chapter 2. Lab #2 and Homework #2 due next week. Quiz #1 next week.
Welcome! Workshop 2 of 7.
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 10 Clusters and Matrices  Read Bishop, Sections 6.4 to  Lab #10 and Homework #10 due next week.
Introduction to LabVIEW
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 5 Loops  Read Bishop, Sections 5.1 and 5.2.  Lab #5 and Homework #5 due next week.  Exam #1 next.
CS320n –Visual Programming LabVIEW Foundations. Visual ProgrammingLabVIEW Foundations2 What We Will Do Today Hand back and review the midterm Look at.
Chapter 6 Arrays & Clusters. LabVIEW Arrays > Collection of Elements > Same Data Type > Variable-Sized > One or More Dimensions.
Infinity-project.org Engineering education for today’s classroom The Infinity Project SM LabVIEW for The Infinity Project.
Workshop 3 of 7 Welcome!. Today's Topics Review of Workshop 2 Loops While For Auto-indexing Shift registers Case Structure.
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 8 Other Structures; Local Variables  Read Bishop, Sections 5.6 to  Lab #8 and Homework #8 due.
Virtual Instrumentation With LabVIEW. Course Goals Understand the components of a Virtual Instrument Introduce LabVIEW and common LabVIEW functions Create.
LabVIEW an Introduction
Each VI has 2 Windows Front Panel User Interface (UI) –Controls = Inputs –Indicators = Outputs Block Diagram Graphical Code –Data travels on wires from.
Design of Bio-Medical Virtual Instrumentation Tutorial 3.
EET 2259 Unit 7 Case Structures; Sequence Structures  Read Bishop, Sections 5.4 and 5.5.  Lab #7 and Homework #7 due next week.  Quiz #3 next week.
Creating, Editing, & Debugging a VI A.How to Create VIs B.How to Edit VIs C.How to Debug VIs You Will Learn:
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
CS320n –Visual Programming
CLUSTERS and ARRAYS. Array Functions  Build an array  Size an array  Form an array from a cluster or a cluster into an array  Index an array  Find.
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 9 Arrays  Read Bishop, Sections 6.1 to 6.3.  Homework #9 and Lab #9 due next week.  Quiz #5 next.
Digital Electronics and Computer Interfacing Tim Mewes 2. LabVIEW Basics part II.
Array Controls and Indicators
LabVIEW Course Course 2.
Chapter 6 Arrays & Clusters. LabVIEW Arrays > Collection of Elements > Same Data Type > Variable-Sized > One or More Dimensions.
MEH108 - Intro. To Engineering Applications KOU Electronics and Communications Engineering.
Week 3 Data Structures and Common Tools. Common Tools in Labview Automatic Tool Selector Using the Operating Tool Using the Positioning Tool to Select.
Arrays Chapter 7.
Week 3 Labview exercises
String and Lists Dr. José M. Reyes Álamo.
Chapter 11 - JavaScript: Arrays
EET 2259 Unit 13 Strings and File I/O
Data Structures Arrays Common Array Functions Polymorphism
Course Learning Map Lesson # Lesson Title Lesson 3 Lesson 2 Lesson 1
EE 200 Design Tools Laboratory 14
EGR 2261 Unit 10 Two-dimensional Arrays
EET 2259 Unit 11 Charts and Graphs
EGR 2261 Unit 9 One-dimensional Arrays
Computer Programming BCT 1113
EGR 2261 Unit 4 Control Structures I: Selection
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
EET 2259 Unit 3 Editing and Debugging VIs
JavaScript: Functions.
Chapter 5: Arrays: Lists and Tables
Course Learning Map Lesson # Lesson Title Lesson 3 Lesson 2 Lesson 1
Introduction to LabVIEW
Lab 2 : Structures Muhammad Zaigham Abbas Shah DIGITAL INSTRUMENTATION SYSTEMS.
Lesson 2: Introduction to Control programming using Labview
Doing some Boolean: On/Off
הודעות ריענון מהיר והרחבות כתיבה לקובץ Low-Level דגימת אות Low-Level
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
LabVIEW 7.1 寒假短期教學課程 歐陽丞修 2006/02/06.
Introduction To Programming Information Technology , 1’st Semester
String and Lists Dr. José M. Reyes Álamo.
EET 2259 Unit 6 Shift Registers
Structures- case, sequence, formula node
CIS16 Application Development and Programming using Visual Basic.net
CST-115 Introduction to Computer Programming
Functions continued.
Data Structures & Algorithms
Introduction to LabVIEW
EET 2259 Unit 13 Strings and File I/O
EET 2259 Unit 7 Case Structures; Sequence Structures
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
EET 2259 Unit 11 Charts and Graphs
EET 2259 Unit 2 Virtual Instruments
EET 2259 Unit 6 Shift Registers
EET 2259 Unit 8 Other Structures; Local Variables
Arrays.
EET 2259 Unit 3 Editing and Debugging VIs
Presentation transcript:

EET 2259 Unit 9 Arrays Read Bishop, Sections 6.1 to 6.3. Homework #9 and Lab #9 due next week. Quiz #5 next week -In programs written up to now, controls, indicators, and wires have held only one value at a time. Arrays and clusters let you group together many values in a control, indicator, or wire. -On E-mail Notification example note difference in thickness of 2 pink lines from sequence structure. Also note array of simulated temp values on block diagram of Simulated Temp.vi

Arrays and Clusters An array is a variable-sized collection of data elements that are all of the same data type (such as floating point, integer, string, or Boolean). A cluster is a fixed-sized collection of data elements of mixed data types. (Bishop, p. 289)

Usefulness of Arrays Arrays are useful when you have a collection of data points that you wish to plot or a collection of similar items that you wish to manipulate as a group. (Bishop, p. 289)

Dimension of an Array Every array has a dimension. The simplest arrays are one-dimensional arrays, which you can think of as a list of items. Example: a list of student grades on a single assignment in a class: 90, 77, 82, 95, 60, : (Bishop, p. 289) -In this example, each item represents the grade of a different student. You can refer to any item in the list by its position in the list. -Suppose you want to find average grade and max and min grades on an assignment. Without using arrays, you’d need one numeric control for each student, and then wire them together using math functions. -Demo this for five students.

Creating an Array of Controls or Indicators To create an array of controls or indicators: Place an array shell on the front panel from the Controls >> Modern >> Array, Matrix & Cluster palette. Place a control or indicator inside that array shell. We’ll see that you can also create arrays using block-diagram functions. -Demo creating an array of numeric controls.

Displaying Multiple Elements To display more than one element of an array on the front panel, drag the array’s resizing handles until the desired number of elements are visible. The box to the left shows the index of the first visible element. (Bishop, p. 290) -Demo by typing in values to numeric controls, and then show how easy it is to find average (using Add Array on Numeric palette), max, and min(using Max&Min on Arrays palette).

Index of an Element Each element in an array can be referred to by its index, which is an integer showing the element’s position in the array. In LabVIEW, indexes are zero-based. So the first element in a one-dimensional array has an index of 0, the second element has an index of 1, and so on. If a one-dimensional array contains n elements, the last element has an index of n1. (Bishop, p. 289) For a two-dimensional array, the index is a pair of numbers identifying the item’s row and column.

Array Terminal on Block Diagram When an array shell is first created, its terminal on the block diagram is outlined in black and shows no data type. After the array’s data type has been defined by placing an item in the shell, the terminal changes color to show the data type. (Bishop, p. 292)

Array Wires on Block Diagram On the block diagram, a wire carrying an array of data values is thicker than a wire carrying a single data value. (Bishop, p. 292) Demo by wiring a single toggle switch to a single LED, and then wiring an array of toggle switches to an array of LEDs.

Arrays & the DAQ Assistant When you use the DAQ Assistant to perform digital input, the DAQ Assistant produces an array of Boolean values. And when you use it to perform digital output, you must provide the DAQ Assistant with an array of Boolean values. That’s why LabVIEW has sometimes slipped in another function when you placed a From DDT or To DDT. Demo by examining Lab3DigitalInput.vi and Lab3DigitalOutput.vi.

Creating Arrays with Loops A useful feature called auto- indexing on a loop lets you tell LabVIEW to create an array automatically when the loop runs. To enable or disable auto-indexing, right-click a tunnel on a loop’s border and select Enable Indexing or Disable Indexing. -Demo with For Loop that generates 50 random numbers; create indicator on the random number itself, and on a wire running from the random number to the border. Then create indicator on that tunnel. -Now we can understand difference between having indexing enabled or disabled (Week 5).

Removing Elements from an Array To manually remove an element on the front panel, right-click the element and select Data Operations > Delete Element. To manually remove all elements, right-click the array’s index display and select Data Operations > Empty Array. -Demo deleting an element and emptying the array.

Array Functions The Functions >> Programming >> Array palette provides many functions for working with arrays, including: Array Size Index Array Array Subset Build Array Initialize Array Delete From Array

Array Size The Array Size function takes an array as its input. For its output, it returns the number of elements in that array. The input array can be of any data type (numeric, Boolean, string). The output returned by the function is an integer. (Bishop, p. 297) -Demo by placing an array of numeric controls, entering six or eight numbers, and then displaying the array size on an indicator.

Index Array The Index Array function takes an array and a number (called index) as its inputs. For its output, it returns the element at the index position in that array. The input array can be of any data type (numeric, Boolean, string). The output returned by the function is of the same type. (Bishop, p. 302) Demo with previous example.

Array Subset The Array Subset function takes an array and two numbers (one called index and one called length) as its inputs. For its output, it returns a new array containing the portion of the original array starting at index and containing length elements. The input array can be of any data type (numeric, Boolean, string). The output returned by the function is an array of the same type. (Bishop, p. 301) -Demo -This is one way to create an array on the block diagram.

Build Array The Build Array function takes arrays and/or individual data values as its inputs. For its output, it returns an array containing all elements from the input arrays and values. The input arrays and data values must be of the same type as each other (numeric, Boolean, string). The output returned by the function is an array of that same type. (Bishop, p. 300) -Demo by generating a few random numbers and building them into an array.

Initialize Array The Initialize Array function takes an integer n and a data value as its inputs. For its output, it returns a newly created array containing n elements, each of which is equal to the specified data value. The input data value can be of any data type (numeric, Boolean, string). The output returned by the function is an array of that same type. (Bishop, p. 298) -Demo by initializing and then displaying an array with 15 elements. -This gives a way of creating arrays on the block diagram, instead of on the front panel.

Delete From Array The Delete From Array function takes an array and two numbers (one called index and one called length) as its inputs. For its output, it returns a new array equal to the original array but without the length elements starting at index. The input array value can be of any data type (numeric, Boolean, string). The output returned by the function is an array of that same type. -Demo.

Some Other Array Functions Here are a few other useful array functions that are easy to understand: Sort 1D Array Search 1D Array Reverse1D Array

Two-Dimensional Array Think of a two-dimensional array as a set of items arranged in a table. Example: a table of student grades on the assignments in a class: 90, 86, 93, … 77, 92, 68, … 82, 84, 82, … : : : In this example, each row represents a different student, and each column represents a different assignment. You can refer to any element in this table by its row number and column number. -Again, without arrays, this would require a lot of numeric controls.

Creating a Two-Dimensional Array To expand a front-panel 1-D array to 2-D, right-click the array’s index display and select Add Dimension.

Higher-Dimensional Arrays Three-dimensional and higher-dimensional arrays are also possible, but we’ll concentrate on one-dimensional and two-dimensional arrays. Example of a 3-D array: if students took the same class again semester after semester, you could stack up versions of the table shown on the previous slide. You can refer to any element in this 3-D array by its row number, column number, and layer number.