size():獲取矩陣的行數(shù)和列數(shù) (1)s=size(A),
當(dāng)只有一個(gè)輸出參數(shù)時(shí),返回一個(gè)行向量,該行向量的第一個(gè)元素時(shí)矩陣的行數(shù),第二個(gè)元素是矩陣的列數(shù)。
(2)[r,c]=size(A),
當(dāng)有兩個(gè)輸出參數(shù)時(shí),size函數(shù)將矩陣的行數(shù)返回到第一個(gè)輸出變量r,將矩陣的列數(shù)返回到第二個(gè)輸出變量c。
(3)size(A,n)如果在size函數(shù)的輸入?yún)?shù)中再添加一項(xiàng)n,并用1或2為n賦值,則 size將返回矩陣的行數(shù)或列數(shù)。其中r=size(A,1)該語句返回的時(shí)矩陣A的行數(shù), c=size(A,2) 該語句返回的時(shí)矩陣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
掃碼關(guān)注5G通信官方公眾號(hào),免費(fèi)領(lǐng)取以下5G精品資料
1、回復(fù)“YD5GAI”免費(fèi)領(lǐng)取《中國移動(dòng):5G網(wǎng)絡(luò)AI應(yīng)用典型場(chǎng)景技術(shù)解決方案白皮書》
2、回復(fù)“5G6G”免費(fèi)領(lǐng)取《5G_6G毫米波測(cè)試技術(shù)白皮書-2022_03-21》
3、回復(fù)“YD6G”免費(fèi)領(lǐng)取《中國移動(dòng):6G至簡無線接入網(wǎng)白皮書》
4、回復(fù)“LTBPS”免費(fèi)領(lǐng)取《《中國聯(lián)通5G終端白皮書》》
5、回復(fù)“ZGDX”免費(fèi)領(lǐng)取《中國電信5G NTN技術(shù)白皮書》
6、回復(fù)“TXSB”免費(fèi)領(lǐng)取《通信設(shè)備安裝工程施工工藝圖解》
7、回復(fù)“YDSL”免費(fèi)領(lǐng)取《中國移動(dòng)算力并網(wǎng)白皮書》
8、回復(fù)“5GX3”免費(fèi)領(lǐng)取《 R16 23501-g60 5G的系統(tǒng)架構(gòu)1》
作者的更多帖子

笨蛋就是你,你就是個(gè)大笨蛋
|
|
|
|
|