|
size():获取矩阵的行数和列数 (1)s=size(A),
当只有一个输出参数时,返回一个行向量,该行向量的第一个元素时矩阵的行数,第二个元素是矩阵的列数。
(2)[r,c]=size(A),
当有两个输出参数时,size函数将矩阵的行数返回到第一个输出变量r,将矩阵的列数返回到第二个输出变量c。
(3)size(A,n)如果在size函数的输入参数中再添加一项n,并用1或2为n赋值,则 size将返回矩阵的行数或列数。其中r=size(A,1)该语句返回的时矩阵A的行数, c=size(A,2) 该语句返回的时矩阵A的列数。
另外,length()=max(size()).
MATLAB help 解释 :
>> help size
sizeSize of array.
D = size(X), for M-by-N matrix X, returns the two-element row vector
D = [M,N] containing the number of rows and columns in the matrix.
For N-D arrays, size(X) returns a 1-by-N vector of dimension lengths.
Trailing singleton dimensions are ignored.
[M,N] = size(X) for matrix X, returns the number of rows and columns in
X as separate output variables.
[M1,M2,M3,...,MN] = size(X) for N>1 returns the sizes of the first N
dimensions of the array X.If the number of output arguments N does
not equal NDIMS(X), then for:
N > NDIMS(X), size returns ones in the "extra" variables, i.e., outputs
NDIMS(X)+1 through N.
N < NDIMS(X), MN contains the product of the sizes of dimensions N
through NDIMS(X).
M = size(X,DIM) returns the length of the dimension specified
by the scalar DIM.For example, size(X,1) returns the number
of rows. If DIM > NDIMS(X), M will be 1.
When size is applied to a Java array, the number of rows
returned is the length of the Java array and the number of columns
is always 1.When size is applied to a Java array of arrays, the
result describes only the top level array in the array of arrays.
Example:
If
X = rand(2,3,4);
then
d = size(X)returnsd = [2 3 4]
[m1,m2,m3,m4] = size(X)returnsm1 = 2, m2 = 3, m3 = 4, m4 = 1
[m,n] = size(X) returnsm = 2, n = 12
m2 = size(X,2)returnsm2 = 3
扫码关注5G通信官方公众号,免费领取以下5G精品资料
1、回复“YD5GAI”免费领取《中国移动:5G网络AI应用典型场景技术解决方案白皮书》
2、回复“5G6G”免费领取《5G_6G毫米波测试技术白皮书-2022_03-21》
3、回复“YD6G”免费领取《中国移动:6G至简无线接入网白皮书》
4、回复“LTBPS”免费领取《《中国联通5G终端白皮书》》
5、回复“ZGDX”免费领取《中国电信5G NTN技术白皮书》
6、回复“TXSB”免费领取《通信设备安装工程施工工艺图解》
7、回复“YDSL”免费领取《中国移动算力并网白皮书》
8、回复“5GX3”免费领取《 R16 23501-g60 5G的系统架构1》
作者的更多帖子

笨蛋就是你,你就是个大笨蛋
|
|
|
|
|
| |
|