NI官方labview培训教材Lesson 5-8ppt课件
Lesson 5 ClustersTOPICS Introduction to Clusters Cluster Functions Error Clusters1Clusters Data structure that groups data together Data may be of different types Analogous to struct in C or a record in Pascal Elements must be either all controls or all indicators Thought of as wires bundled into a cable 21. Select a Cluster shell from the Array each number represents a color Use these options to set and display color mapping scheme Cursor also adds a third dimension25The waveform chart is a special numeric indicator that displays one or more plots. The waveform chart has the following three update modes: A strip chart shows running data continuously scrolling from left to right across the chart. A scope chart shows one item of data, such as a pulse or wave, scrolling partway across the chart from left to the right. A sweep works similarly to a scope except it shows the old data on the right and the new data on the left separated by a vertical line. Waveform graphs and XY graphs display data from arrays. Right-click a waveform chart or graph or its components to set attributes of the chart and its plots.Summary26You can display more than one plot on a graph using the Build Array function and the Bundle function for charts and XY graphs. The graph becomes a multiplot graph when you wire the array of outputs to the terminal. When you wire data to charts and graphs, use the Context Help window to determine how to wire them. You can use intensity charts and graphs to plot three-dimensional data. The third dimension is represented by different colors corresponding to a color mapping that you define. Intensity charts and graphs are commonly used in conjunction with spectrum analysis, temperature display, and image processing.Summary, cont.27Lesson 7 Making Decisions in a VITOPICS Decision making with the Select function Case Structures Formula Nodes28Simple Decision: Select Function If Temp Scale is TRUE, pass top input; if temp scale is FALSE, pass bottom input. If the decision to be made is more complex than a Select function can execute, a Case Structure may be what is required.29Boolean Case Structure Example: If Temp Scale is TRUE, execute True case; if temp scale is FALSE, execute False case.Case Structures30 In the Structures subpalette of Functions palette Enclose nodes or drag them inside the structure Stacked like a deck of cards, only one case visible at a timeCase Structures31Boolean and Numeric CasesWire all possible outputs of the case structure32String, Enum, and Error CasesString Case Enum Case Error Case33 In the Structures subpalette Implement complicated equations Variables created at border Variable names are case sensitive Each statement must terminate with a semicolon (;) Context Help Window shows available functionsNote semicolonFormula Node34Decision Making with Formula NodesTwo different ways of using an if-then statement in a Formula NodeBoth structures produce the same result35The Select function is used to choose between two inputs dependant on a boolean input. A Case structure has two or more cases. Only one case is visible at a time, and the structure executes only one case at a time. If the case selector terminal is Boolean, the structure has a TRUE case and a FALSE case. If the selector terminal is an integer, string, or enumerated type value, the structure can have up to 2311 cases.Inputs are available to all cases, but cases do not need to use each input. If at least one output tunnel is not defined, all output tunnels on the structure appear as white squares. Formula Nodes are useful for complicated equations and for using existing text-based code. A semicolon (;) must terminate each statement.Summary36Lesson 8 Strings and File I/OTOPICS How to create string controls and indicators How to use several String functions About file I/O operations How to use the high-level File I/O VIs How to use the low-level File I/O VIs How to format text files for use in spreadsheets37 A string is a sequence of displayable or - characters (ASCII) Many uses displaying messages, instrument control, file I/O String control/indicator is in the Controls»String subpaletteStrings38String Display ModesNormal displayPassword display code displayHex display39Concatenate Strings (spaces here)String LengthString Functions40String FunctionsString SubsetMatch Pattern41Converting Numerics to Strings: Build String42Converting Strings to Numerics: Scan From String43Edit Format StringScan From String Function44File Input and OutputFour Hierarchy Levels:High-level File VIsIntermediate File VIs and FunctionsAdvanced File Functions subpaletteExpress VIs45 Write to Spreadsheet File Read from Spreadsheet File Write Characters to File Read Characters from File Read Lines from FileHigh-level File I/O VIs46File I/O Programming Model - IntermediateOpen/ Create/ Replace FileRead and/or Write to FileClose FileCheck for Errors47Write to File Example Open/Crea