フィルターのクリア

access the row and col of a matrix

4 ビュー (過去 30 日間)
Elysi Cochin
Elysi Cochin 2017 年 4 月 21 日
編集済み: Stephen23 2017 年 4 月 21 日
i have a matrix
A = [11 12 13
14 15 16
17 18 19];
now i take a value 6... how can i get the value there and and row and column....
eg: value = 16
row = 2
col = 3

採用された回答

Stephen23
Stephen23 2017 年 4 月 21 日
編集済み: Stephen23 2017 年 4 月 21 日
>> N = 6; % your input
>> [col,row] = ind2sub(size(A),N)
col = 3
row = 2
>> val = A(row,col)
val = 16

その他の回答 (2 件)

dbmn
dbmn 2017 年 4 月 21 日
2 Possibilities
Easiest: row column
A(2,3)
Second possibility (by element count)
A(8)

Eng. Fredius Magige
Eng. Fredius Magige 2017 年 4 月 21 日
call it as: call=A(2,3)

カテゴリ

Help Center および File ExchangeTransfer Function Models についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by