Presentation is loading. Please wait.

Presentation is loading. Please wait.

336540 Design of Bio-Medical Virtual Instrumentation Tutorial 3.

Similar presentations


Presentation on theme: "336540 Design of Bio-Medical Virtual Instrumentation Tutorial 3."— Presentation transcript:

1 336540 Design of Bio-Medical Virtual Instrumentation Tutorial 3

2 Outline Enums Arrays Clusters Plotting data Type definitions Case structure

3 E-nums An Enum is a combination of data types which represent a pair of values, a string and a numeric where the e-num can be one of a list of values Enums are useful because it’s easier to manipulate numbers on the block diagram than strings

4 Arrays Arrays – collection of data elements that are all the same type Arrays in LabVIEW can be of any type The array’s indexes are in the range of 0 to N-1 Creating array Controls and Indicators: combining an array shell with a data object:

5 To add n dimensions to the array control or indicator, right-click the array index display and select Add Dimension from the shortcut menu. The example below shows a 2D digital control array. Arrays

6 Array functions: Creating Arrays with Loops The For Loop and While Loop can index and accumulate arrays at their boundaries automatically. This capability is called auto-indexing.

7 Polymorphism The LabVIEW numeric functions are polymorphic- the inputs to these functions can be different data structures:

8 Clusters Clusters group data elements of mixed types Creating cluster controls and indicators: adding a cluster shell to the front panel and dragging the data element into the cluster shell Use the Unbundle function to split a cluster into its individual elements

9 Exercise 1 Identify the data type of the wires labeled with numbers 1-9

10 Plotting data Chart Vs. Graph: In order to display multiple plots together use the Bundle function

11 You can bundle data consisting of the initial X value, the delta X value, and a data array to the waveform graph The XY Graph is a general-purpose Cartesian graphing object ideal for plotting multivalued functions such as circular shapes

12 Build a VI that displays two random plots on a waveform chart in sweep update mode. The plots should be a random plot and a running average of the last four points. Build a VI that generates a 2D array of three rows by 10 columns containing random numbers. After generating the array, index each row and plot each row on its own graph. The front panel should contain three graphs. Exercise 2

13 Type Definitions You can use type definitions to define custom arrays and clusters A type definition is a master copy of a custom data type (custom control, indicator or constant) Creating a custom control:

14

15 Case structure The Case structure is analogous to case statements or if...then...else statements in conventional, text-based programming languages Only one case executes, depending on the value wired to the selector terminal – You must define the output tunnel for each case In a numeric or string case structure you must define a default case

16 Making a decision in LabVIEW 1.Case Structures 2.Select

17 Create an E-num control with 4 possible values: add, subtract, multiply and divide. Create a VI which gets two numbers from the user, chooses which action to calculate according to the E-num case that the user chose and presents the result (use case structure). Exercise 3


Download ppt "336540 Design of Bio-Medical Virtual Instrumentation Tutorial 3."

Similar presentations


Ads by Google