เอกสาร matlablanguage อาเรย์กำลังทำดัชนี

รหัสตัวอย่าง

5
0

เอกสาร matlablanguage เมตริกซ์ว่างดัชนี

A = [16 5 9; 4 2 11; 7 14 9]; % Create matrix

A(2,3)   % Extract the element in row 2, column 3
ans = 11

A(1:2,2:3) % Extract elements in rows 1 and 2, and columns 2 and 3
ans = 	5	9
		2	11
0
0

เอาส่วนประกอบของเอกสาร matlablanguage อาเรย์

Indicating indexes between ([]) retrieves corresponding values in Matlab. 
array_borders=array([1: end])
As end defines size of the array, retrieve first and last border values of array
0
0

เอกสาร matlablanguage เมตริกซ์กำลังทำดัชนี

v = [16 5 9 4 2 11 7 14];
v(3)     % Extract the third element  (ans = 9)
-1
0

เอกสาร matlablanguage อาเรย์กำลังทำดัชนี

Indicating indexes between ([]) retrieves corresponding values in Matlab. 
array_borders=array([1 end])
As end defines size of the array, retrieve first and last border values of array
even_values=array(2:2:end)
Retrieve only second elements of array, from secon with 2 step iteration 
increase until end of array.
first_3_values=array(1:3)
Retrieve only first 3 elements of array.

ในภาษาอื่นๆ

หน้านี้อยู่ในภาษาอื่นๆ

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................

ดังอยู่ในนี้หมวดหมู่

ดังหน้ากับตัวอย่างอยู่ในหมวดหมู่