How do I get index matrix for matrix of values?

1 回表示 (過去 30 日間)
sarah
sarah 2021 年 3 月 5 日
編集済み: Fangjun Jiang 2021 年 3 月 5 日
hi, can anyone one help me
if i have matrix A i want get index matrix for matrix A
A=[9 5 1
6 5 7
8 4 11]
for exmple The result
A_index =11 12 13
21 22 23
31 32 33
  4 件のコメント
Cris LaPierre
Cris LaPierre 2021 年 3 月 5 日
Please share your code, too.
Fangjun Jiang
Fangjun Jiang 2021 年 3 月 5 日
編集済み: Fangjun Jiang 2021 年 3 月 5 日
It looks like
Row 1 Column 1, Row 1 Column 2, Row 1 Column 3
Row 2 Column 1, Row 2 Column 2, Row 2 Column 3
I don't know what is the meaning, purpose or usefulnesss for this

サインインしてコメントする。

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 3 月 5 日
編集済み: Cris LaPierre 2021 年 3 月 5 日
Now I'm confused, too. You've now posted two completely different types of index matrices. Perhaps instead, could you explain how A maps to A_index?
A_index =11 12 13
21 22 23
31 32 33
As for the current A_index, you can take advantage of implicit expansion to create it.
A_index = (10:10:30)' + (1:3)
A_index = 3×3
11 12 13 21 22 23 31 32 33
  6 件のコメント
Cris LaPierre
Cris LaPierre 2021 年 3 月 5 日
I'm trying to build inverse matrix
Have you tried the inv function?
sarah
sarah 2021 年 3 月 5 日
A_index = (10:10:160)' + (1:16)
i think it is better to convert the values to hexadecimal so that there is no duplication

サインインしてコメントする。

その他の回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2021 年 3 月 5 日
編集済み: Fangjun Jiang 2021 年 3 月 5 日
>> [Row,Column]=ind2sub([3,3],1:9)
Row =
1 2 3 1 2 3 1 2 3
Column =
1 1 1 2 2 2 3 3 3
>> [Row,Column]=ind2sub([11,11],[10,11,12, 109,110,111])
Row =
10 11 1 10 11 1
Column =
1 1 2 10 10 11

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by