How do I get index matrix for matrix of values?

2 views (last 30 days)
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 Comments
Fangjun Jiang
Fangjun Jiang on 5 Mar 2021
Edited: Fangjun Jiang on 5 Mar 2021
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

Sign in to comment.

Accepted Answer

Cris LaPierre
Cris LaPierre on 5 Mar 2021
Edited: Cris LaPierre on 5 Mar 2021
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 Comments
Cris LaPierre
Cris LaPierre on 5 Mar 2021
I'm trying to build inverse matrix
Have you tried the inv function?
sarah
sarah on 5 Mar 2021
A_index = (10:10:160)' + (1:16)
i think it is better to convert the values to hexadecimal so that there is no duplication

Sign in to comment.

More Answers (1)

Fangjun Jiang
Fangjun Jiang on 5 Mar 2021
Edited: Fangjun Jiang on 5 Mar 2021
>> [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

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!