博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
IDL array subscript
阅读量:2442 次
发布时间:2019-05-10

本文共 2706 字,大约阅读时间需要 9 分钟。

There are six types of subscript ranges:

Subscript Format

Description

[*]

All elements of a dimension.

This form is used with multidimensional arrays to select all elements along the dimension. For example, if arr is a 10-column by 12-row array, arr[*, 11] is the last row of arr, composed of elements [arr[0,11], arr[1,11], ..., arr[9,11]], and is a 10-element row vector. Similarly,arr[0, *] is the first column of arr[arr[0,0], arr[0,1],..., arr[0,11]], and its dimensions are 1 column by 12 rows.

[s0:s1]

Subscript range from s0 to s1.

This denotes all elements whose subscripts range from the expression s0 through s1(s0 must not be greater than s1). For example, if the variable vec is a 10-element vector, vec[4:8] is a five-element vector composed of vec[4] through vec[8]. Negative indices may be used, where -1 indicates the last element. For example, vec[-6:-2] returns the same five elements as vec[4:8].

[s0:*]

or

[s0:-1]

A range from the given element to the last element of dimension.

This denotes all elements from a given element to the last element of the dimension. If the variablevec is a 50-element vector, vec[10:*] is a 40-element vector made from vec[10] through vec[49].

[s0:s1:n]

Every n-th element in a range of subscripts from s0 to s1.

The expression n is referred to as the subscript stride. The stride value may be positive or negative (but must not be zero). If the stride is positive then s0 must be less than or equal to s1. If the stride is negative then s0 must be greater than or equal to s1. If the stride is 1, then the result is identical in meaning to [s0:s1], as described above. For example, if the variable vec is a 50-element vector,vec[5:13:2] is a five-element vector composed of vec[5]vec[7]vec[9]vec[11], and vec[13]. In another example, vec[-1:0:-3] would return every third element of vec, in reverse order.

[s0:*:n]

or

[s0:-1:n]

Every n-th element from element s0 to the end of the dimension.

The expression n is referred to as the subscript stride. If the variable vec is a 50-element vector,vec[10:*:4] is a 10-element vector made from every fourth element between vec[10] throughvec[46].

[n]

A simple subscript, either positive or negative.

Positive subscripts are indexed from the beginning of the array, while negative subscripts are indexed from the end (where -1 is the last element). When used with multidimensional arrays, simple subscripts specify only elements with subscripts equal to the given subscript in that dimension.

Multidimensional subarrays can be specified using any combination of the above forms. For example, if arr is a 10x10 array, arr[*,0:4] returns a 10 x 5 array that is made from all columns of rows 0 to 4 of arr.

转载地址:http://ltiqb.baihongyu.com/

你可能感兴趣的文章
node_modules文件夹的大小不是问题。 这是一种特权
查看>>
dom 删除所有子元素_如何从DOM元素中删除所有子级
查看>>
html 打印样式控制_如何使用样式打印HTML
查看>>
gatsby_Next.js vs Gatsby vs create-react-app
查看>>
掌握React.Memo
查看>>
golang 延迟_了解Go中的延迟
查看>>
react 组件样式_如何设置React组件的样式
查看>>
node.js 模块_如何创建Node.js模块
查看>>
centos上安装git_如何在CentOS 8上安装Git
查看>>
在JavaScript中优化switch语句
查看>>
express 模板引擎_了解Express模板引擎
查看>>
如何在CentOS 8上安装Node.js
查看>>
如何在Ubuntu 20.04上安装Git
查看>>
javascript深度图_在JavaScript中深度克隆对象(及其工作方式)
查看>>
centos ssh密钥_如何在CentOS 8上设置SSH密钥
查看>>
debian 10 安装_如何在Debian 10上安装Webmin
查看>>
使用CentOS 8进行初始服务器设置
查看>>
ecmascript v3_节点v12中的新ECMAScript模块简介
查看>>
盖茨比乔布斯_通过盖茨比使用Airtable
查看>>
mern技术栈好处?_如何开始使用MERN堆栈
查看>>