Section 3 What Are Arrays? 数组
推荐给好友
打印
加入收藏
更新于2008-05-16 19:20:07

What Are Arrays?

什么是数组?



Until now, we've dealt with scalar numbers only (a scalar is simply a data type that contains a single value, or "non-array"), and now it's time to move onto something more powerful and compound. A LabVIEW array is a collection of data elements that are all the same type, just like in traditional programming languages. An array can have one or more dimensions, and up to 231-1 elements per dimension (memory permitting, of course). An array data element can have any type except another array, a chart, or a graph.

目前,我们只涉及标量数据的处理(标量数据是只包含单个数值的简单数据结构,或称“非数组”数据),现在我们将目标转移到功能更强大的复合数据上。LabVIEW数组和传统编程语言中的数组一样,是一个包含同种类型数组的元素的集合。数组可以是一维或多维,每一维中最多可有231-1个元素(当然是由内存决定的)。数组元素可以是任何数据类型,但不包括chart和graph,数组也不能包括数组。



Array elements are accessed by their indices; each element's index is in the range 0 to N-1, where N is the total number of elements in the array. The one-dimensional (1D) array shown here illustrates this structure. Notice that the first element has index 0, the second element has index 1, and so on.

存取数组的元素要通过索引,每个元素按从0到N-1的顺序索引,N是数组中全部元素的个数。这里列出的一维数组说明了数组的结构,注意第一个元素的索引是0,第二个是1,以此类推。

You will find that waveforms (and many other things) are often stored in arrays, with each point in the waveform comprising an element of the array. Arrays are also useful for storing data generated in loops, where each loop iteration generates one element of the array.

你会发现,波形数据(和其他很多数据)经常被保存在数组中,波形中的每个点对应数组中的一个元素。数组还可以用来存储循环中产生的数据,每一次循环的数据对应数组的一个元素。

 

<<PREV    NEXT>>




 
关于我们 | 诚邀加盟 | 客户服务 | 相关法律 | 网站地图 | 友情链接 | 服务信箱:service@eefocus.com
© 2006 与非门科技信息咨询(北京)有限公司 All Rights Reserved.