Matlab基本函式 length函式

2021-08-27 15:54:55 字數 1897 閱讀 3013

1、length函式:計算向量或矩陣的長度

2、用法說明

y = length(x) 函式計算指定向量或矩陣的長度y。如果引數變數x是向量,則返回其長度;如果引數變數是非空矩陣,則length(x)與max(size(x))等價

3、舉例說明

>> x = 'youhaidong'

x =youhaidong

>> y = length(x)

y = 10

>> x = rand(6,6)

x = 0.8147 0.2785 0.9572 0.7922 0.6787 0.7060

0.9058 0.5469 0.4854 0.9595 0.7577 0.0318

0.1270 0.9575 0.8003 0.6557 0.7431 0.2769

0.9134 0.9649 0.1419 0.0357 0.3922 0.0462

0.6324 0.1576 0.4218 0.8491 0.6555 0.0971

0.0975 0.9706 0.9157 0.9340 0.1712 0.8235

>> y = length(x)

y = 6

4、附錄

>> help length

length length of vector.

length(x) returns the length of vector x. it is equivalent

to max(size(x)) for non-empty arrays and 0 for empty ones.

see also numel.

overloaded methods:

timer/length

serial/length

daqdevice/length

daqchild/length

distributed/length

codistributed/length

composite/length

gpuarray/length

fints/length

videosource/length

videoinput/length

visa/length

udp/length

tcpip/length

icgroup/length

icdevice/length

i2c/length

gpib/length

bluetooth/length

xregpointer/length

mbcstore/length

guidarray/length

cgrules/length

designdev/length

des_constraints/length

coninputfactor/length

xregcontainer/length

xregmulti/length

xregcovariance/length

xregmonitorplotproperties/length

xregdataset/length

cgtradeoffkeytable/length

dataset/length

categorical/length

tscollection/length

reference page in help browser

doc length

Matlab基本函式

conndef 建立連通矩陣 imbothat 執行bottom hat濾波 imclearborder 抑制邊緣亮結構 imclose 灰度影象或二值影象的閉運算 imdilate 灰度影象或二值影象的膨脹運算 imerode 灰度影象或二值影象的腐蝕運算 imextendedmax 擴充套件極大...

Matlab基本函式 disp函式

1 disp函式 顯示文字或陣列 2 用法說明 disp x 函式顯示指定的文字或陣列。如果參量是陣列,則顯示陣列的內容 如果參量是字串,則顯示字串文字的內容 3 例項 1 參量是字串 x hello,world x hello,world disp x hello,world 2 參量是陣列或矩陣...

Matlab基本函式 floor函式

1 floor函式 朝負無窮大方向取整 2 用法說明 y floor x 函式將x中元素取整,值y為不大於本身的最大整數。對於複數,分別對實部和虛部取整 3 用法舉例 x 3 4i 6 7i 9 11i 1 4i 3.4 4.5i 90.67 123i x 1.0e 02 columns 1 thr...