size():獲取矩陣的行數(shù)和列數(shù) (1)s=size(A),
當只有一個輸出參數(shù)時,返回一個行向量,該行向量的第一個元素時矩陣的行數(shù),第二個元素是矩陣的列數(shù)。
(2)[r,c]=size(A),
當有兩個輸出參數(shù)時,size函數(shù)將矩陣的行數(shù)返回到第一個輸出變量r,將矩陣的列數(shù)返回到第二個輸出變量c。
(3)size(A,n)如果在size函數(shù)的輸入?yún)?shù)中再添加一項n,并用1或2為n賦值,則 size將返回矩陣的行數(shù)或列數(shù)。其中r=size(A,1)該語句返回的時矩陣A的行數(shù), c=size(A,2) 該語句返回的時矩陣A的列數(shù)。
另外,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網(wǎng)絡AI應用典型場景技術解決方案白皮書》
2、回復“5G6G”免費領取《5G_6G毫米波測試技術白皮書-2022_03-21》
3、回復“YD6G”免費領取《中國移動:6G至簡無線接入網(wǎng)白皮書》
4、回復“LTBPS”免費領取《《中國聯(lián)通5G終端白皮書》》
5、回復“ZGDX”免費領取《中國電信5G NTN技術白皮書》
6、回復“TXSB”免費領取《通信設備安裝工程施工工藝圖解》
7、回復“YDSL”免費領取《中國移動算力并網(wǎng)白皮書》
8、回復“5GX3”免費領取《 R16 23501-g60 5G的系統(tǒng)架構1》
作者的更多帖子
![](images/common/sigline.gif)
笨蛋就是你,你就是個大笨蛋
|
|
|
|
|