Linear indexing in symmetric matrices

前端 未结 8 1162
遇见更好的自我
遇见更好的自我 2021-01-05 04:09

We can access matrices using linear indexing, which follows this pattern

0 1 2

3 4 5

6 7 8

It\'s easy to get the i,j coordinates for this cas

8条回答
  •  隐瞒了意图╮
    2021-01-05 04:22

    MATLAB ships with built in functions ind2sub and sub2ind. Please check the documentation of MATLAB.

    Please note that in MATLAB the linear indexing is going down the rows and indexing starts with 1

    Example: for a 3 x 3 matrix

    1 4 7

    2 5 8

    3 6 9

提交回复
热议问题