LABVIEW数组讲义_第1页
LABVIEW数组讲义_第2页
LABVIEW数组讲义_第3页
LABVIEW数组讲义_第4页
LABVIEW数组讲义_第5页
已阅读5页,还剩27页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、LabVIEW Course Map建立建立, 编辑编辑,调试调试 VILabVIEW介绍介绍Arrays, Graphs, & ClustersCase & Sequence Structures andFormula NodesStrings & File I/O建立子建立子VIVI 用户化用户化Data Acquisition& Waveforms仪器控制仪器控制Step 1Step 2Step 3循环及图表循环及图表ArraysArrays 集合同类型数据集合同类型数据 一维或多维一维或多维, 每一维可多达每一维可多达 2 -1(21亿)个元素亿)个元素

2、 通过通过Index可查找某一元素可查找某一元素 index索引的起点是索引的起点是 031index10-element array1.2 3.28.2 8.04.8 5.16.0 1.02.5 1.70 1 2 3 4 5 6 7 8 92D arrayFive-row by seven column array of 35 elements0 1 2 3 4 5 60 1 2 34Array Controls and Indicators增加维数至增加维数至 2D arrays1. 从Controls palette选择Array Shell2. 放一个 data object 到到 s

3、hell中建立 Array 常量1. Select Array Constant shell from the Array subpalette2. Place the data object in the array shellCreating and Using Arrays Auto-Indexing (自动索引)(自动索引) 循环程循环程序在边界处累积数序在边界处累积数组组 For 循环默认是自动循环默认是自动索引索引; While 循环不循环不是是Creating 2D Arrays 内循环建立内循环建立 列元素列元素 外循环是行元素外循环是行元素Arrays 数组控件数组控件其它类

4、型 array 元素Boolean arrays:size=5size=10Arrays 数组控件数组控件String arrays:Path arrays:数组中的元素不能是数组数组中的元素不能是数组数组的维数可以是多维的数组的维数可以是多维的.一维数组一维数组Arrays 数组控件数组控件可显示为行或列,但通常是行可显示为行或列,但通常是行 (row)Arrays 数组控件数组控件多维数组的建立,可用增加数组的多维数组的建立,可用增加数组的index displayrows indexcolumns indexindex display 索引的是左上角单元索引的是左上角单元(cell)内的

5、元素内的元素rowscolumnsArrays 数组控件数组控件3-维数组:rowscolumnspagesrows indexcolumns indexpage indexArrays 数组控件数组控件4-维数组:.Elements of the 4-th dimension are called volumesArrays 数组控件数组控件5维或更高维数在LabVIEW中也是可能的Note: 放置在前面板没有初始化的数组in all dimensions is zero.只有在cell中输入数据才是非0维的.Arrays 数组数组in diagram数组也可只在后面板建立,而没有前面板显示

6、控件。Initialize Array:function is resizableArrays 数组数组in diagramNote: 维数越多,连线越粗维数越多,连线越粗Vector containing 5 elements:2D (5x2) array:3D (5x2x3) array:4D (5x2x3x4) array:Example: gp4_1.vi. Arrays -数组操作数组操作Array Size:Long integer if array is 1D.如果array是多维的则返回值是是多维的则返回值是 1D array 数组元素代表相应空间(dimension)的值Ex

7、ample: gp4_2.vi. Arrays -数组操作数组操作Build Array: array or element 可以是 n-dimensional array 或scalar element. All inputs must be either elements and 1D arrays or n-dimensional and (n-1)-dimensional arrays. 所有的输入必须是相同的数据类型. appended array 是建立的数组. n-D array + (n-1)-D array = n-D arrayn-D array + n-D array =

8、 (n+1)-D arrayExample: gp4_3.vi. Arrays -数组操作数组操作Index Array: n-dimension array 可以是任何的n维数组 index 0 必须是数字. 输入的 index 个数要与数据元素的个数相匹配 of dimensions in n-dimension array. element or subarray 输出是与 n-dimension array 相同的数据元素为提取数组中的某一成分, 可通过设置不同的连线实现. Example: gp4_4.vi. .Graphs 从从 Graph subpalette选择选择 Wavef

9、orm Graph 输出一组数输出一组数 XY GraphPlot Legend(point and line styles)游标Scale Legend移动控制游标显示控制游标坐标值Single-Plot Waveform Graphs统一统一 X 轴轴 - initial X = 0.0, delta X = 1.0统一统一 X 轴轴 定义点间距定义点间距Multiple-Plot Waveform Graphs每行分别显示每行分别显示 (initial X = 0, delta X = 1)每行分别显示每行分别显示(Bundle 定义定义 X 轴增量轴增量)XY Graphs Non-u

10、niform X axis Separate X and Y arrays define data pointsGraphs - no longer a mystery - since we know arraysWhen a graph is placed on the front panel.what appears on the diagramis identical to the array terminalExample: gp4_5.vi. 只有 1D and 2D arrays 可以联接到graph 节点 在 graph上可以显示数据中的每一行数组中的每一行是一条数据曲线Arra

11、y 计算计算Example: gp4_6.vi. Add element by elementMultiply element by elementAdd array to elementExponential of an array.Arrays 其它相关功能其它相关功能:Replace Array Subset: dimension array 相要进行元素替换的数组,可以是 row(s), column(s), or page(s). 输入可以是任何类型的 n-dimension index 0.n 定义数组中要替换的 row, column, or page new element/s

12、ubarray 用来进行替换的row, column, or page 元素 output array 替换了 row(s), column(s), or page(s)元素后的新数组Insert Into Array:Delete from Array:Similar functions:Example: gp4_9.vi. Arrays 其它相关功能其它相关功能: Array Subset: array is a one-dimensional array of any type index must be numeric. If index is less than 0, the fun

13、ction treats it as 0. Index如果大于或等于数组的array size, 则返回的结果为空数组. length must be numeric. 默认的长度是从索引点开始至数组结尾. Arrays 其它相关功能其它相关功能:Search 1D Array:Searches for an element in a 1D array starting at start index. 1D array 可以是任何数据类型的一维数组 element 为要在输入数组中查找的数值. start index must be numeric. The default is 0 inde

14、x of element 是查询 的element 所在位置. 如果没有查到相应的 element, 则index of element 输出为 1. Example: gp4_10.vi. Arrays 其它相关功能其它相关功能:Interpolate 1D Array(插值)插值):用用 fractional index or x 的整数部分索引的整数部分索引array. 用用 fractional index or x t的分数部分在被索引的元素与其相邻元素间插值的分数部分在被索引的元素与其相邻元素间插值.Example: 如下数组向量 V (1D array):Its obvious that:V(0) = 1V(1) = 2etc.如何对1.5处进行插值:V(1.5) = ?This is possible in LabVIEW, but you need to understand how it works.Graphical Programming Lecture 4- Arrays presented by Witold Noco Ph.D.Arrays 其它相关功能其它相关功能:Interpolate 1D Array:V(1.5) = 0 1 2 3 4 index

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论