9-1 ?陣?索?

b@ӯx} A A i CB j 檺iܬ A(i, j)A䤤 i P j YOUС]Subscript^ίޡ]Index^Cb MATLAB AҦx}ܪkOH欰D@VqAҥH A(i, j) M A(i+(j-1)*m) O@˪A䤤 m Nx}ACơCyܻAڭ̥iHϥΤ@ΤGUШӦsx}Aݵ{]p̪ݨDC

HWϬҡAmx}kWpƦrN@UСA] A(2,3)M A(12) ҫ쪺O 9AiҦpUG

Example 1: 09-x}BzPB/matrix01.mA = [4 10 1 6 2; 8 2 9 4 7; 7 5 7 1 5; 0 3 4 5 4; 23 13 13 0 3]; A(2,3) - A(12) ans = 0

ЯSO`NGbU`A|`ΨuVqvBux}vΡu}CvAFקKyVcASOpUG

ڭ̥iHϥίx}UШӶix}ޡ]Indexing^AҦpGiHXx} A ĥ|B CP GBT ҧΦx}pUG

Example 2: 09-x}BzPB/matrix02.mA = [4 10 1 6 2; 8 2 9 4 7; 7 5 7 1 5; 0 3 4 5 4; 23 13 13 0 3]; B = A(4:5, 2:3) B = 3 4 13 13

ڭ̤]iHϥΤ@UЪ覡ӹFP˥تG

Example 3: 09-x}BzPB/matrix03.mA = [4 10 1 6 2; 8 2 9 4 7; 7 5 7 1 5; 0 3 4 5 4; 23 13 13 0 3]; B = A([9 14; 10 15]) B = 3 4 13 13

YnX@CΤ@AiΫ_]:^ӥNҦCƩΦơAҦpGXx} A ĤӪAiJpUG

Example 4: 09-x}BzPB/matrix04.mA = [4 10 1 6 2; 8 2 9 4 7; 7 5 7 1 5; 0 3 4 5 4; 23 13 13 0 3]; B = A(:, 5) B = 2 7 5 4 3

iϥ end oӫOdrӥNY@ת̤jȡAҦpGx} A ĤӪ]ig A(:, end)AҦpG

Example 5: 09-x}BzPB/matrix05.mA = [4 10 1 6 2; 8 2 9 4 7; 7 5 7 1 5; 0 3 4 5 4; 23 13 13 0 3]; B = A(:, end) B = 2 7 5 4 3

Ъ`N end oӫOdrNqOHmܡAbWҤAend N 5AiOb A(21:end) Aend N 25AoO]bx} A @UФA̤jȴNO 25C

~Aڭ̥iHRx}Y@ӾCΪAҦpG

Example 6: 09-x}BzPB/matrix06.mA = [4 10 1 6 2; 8 2 9 4 7; 7 5 7 1 5; 0 3 4 5 4; 23 13 13 0 3]; A(2, :) = [] % R A x}ĤGC A = 4 10 1 6 2 7 5 7 1 5 0 3 4 5 4 23 13 13 0 3

]iH@Rx}ĤGB|B檺UAҦpG

Example 7: 09-x}BzPB/matrix07.mA = [4 10 1 6 2; 7 5 7 1 5; 0 3 4 5 4; 23 13 13 0 3]; A(:, [2 4 5]) = [] % R A x}ĤGB|B A = 4 1 7 7 0 4 23 13

]i̦x} A M˼ơuñơv_ӡAosx} BAҦpG

Example 8: 09-x}BzPB/matrix08.mA = [4 1; 7 7; 0 4; 23 13]; B = [A 1./A] % 1./A Ox} A CӤ˼ B = 4.0000 1.0000 0.2500 1.0000 7.0000 7.0000 0.1429 0.1429 0 4.0000 Inf 0.2500 23.0000 13.0000 0.0435 0.0769

Hint
bWҤAѩx} A tȬ 0 AG˼ 1./A BAMATLAB|ͤ@ӡuHsv^ĵiT]Y "Warning: Divide by zero."^A䤣vT{ΫO`C

̫Ai diag OXx}﨤uUAҦpG

Example 9: 09-x}BzPB/matrix09.mB = [0 1 2 3; 2 3 4 5; 5 6 7 8; 7 8 9 0]; d = diag(B) % Xx} B 﨤u d = 0 3 7 0

]iH reshape Oӧܤ@ӯx}סAҦpG

Example 10: 09-x}BzPB/matrix10.mB = [0 1 2 3; 2 3 4 5; 5 6 7 8; 7 8 9 0]; C = reshape(B, 2, 8) % Nx} B Ʀ 28 sx} C C = 0 5 1 6 2 7 3 8 2 7 3 8 4 9 5 0

bWzdҤAMATLAB |Nx} B Ʀ@ӦVq]Y MATLAB x}ܪk^AANVq릨 28 sx}C

x}ުޥiOdܸUơAYൽγoǧޥAYug{XAٯണ{檺įCרzQϥΦVqƪBӴ{įɡAN@wnΨUدx}ާޥCLx}ާޥAiѨѩnf@uMATLAB{]pGigvĤGu{XPO餧̨ΤơvC


MATLAB{]pGJg