Preventing Undefined Data
- 已更新2026-03-31
- 閱讀時間為 1 分鐘
Do not rely on special values such as NaN, Inf, or empty arrays to determine if a VI produces undefined data. Instead, confirm that the VI produces defined data by making the VI report an error if it encounters a situation that is likely to produce undefined data.
For example, if you create a VI that uses an incoming array to auto‑index a For Loop, determine what you want the VI to do when the input array is empty. Either produce an output error code, substitute defined data for the value that the loop creates, or use a Case structure that does not execute the For Loop if the array is empty.
相關內容
- Block Diagram Objects
- Grouping Data with Arrays and Clusters
- Processing Individual Elements in an Array or a Collection with a Loop
- Case Structures: Executing a Section of Code Based on Input Values
Use the LabVIEW Case structure to run one subdiagram based on a selector input value. The behavior of the Case structure is similar to switch statements or if...then...else statements in text-based languages.