Is there a method to linear index to a transpose matrix without taking the transpose?

조회 수: 10 (최근 30일)
Is there a method to linear index to a transpose matrix without taking the transpose?
  댓글 수: 5
Image Analyst
Image Analyst 2019년 6월 19일
What code is that? Where did you attach it? Who wrote it?
And what is wrong with using the transpose operator '? Why do you need a different way?
Douglas Farinelli
Douglas Farinelli 2019년 6월 19일
The matrix is rather large ... did not desire a copy of it.

댓글을 달려면 로그인하십시오.

채택된 답변

Douglas Farinelli
Douglas Farinelli 2019년 6월 18일
Yes want to index the matrix by rows vs columns. I suppose i can use the function ind2sub and switch the row and col.
  댓글 수: 2
Douglas Farinelli
Douglas Farinelli 2019년 6월 18일
The matrix is not square so the ind2sub would not work.
Walter Roberson
Walter Roberson 2019년 6월 18일
Yes.
Note: for a 2D matrix, ind2sub is (column_number - 1) * number_of_rows + row_number .
You can therefore optimize the access (row_number, column_number) to the transpose (column_number, row_number) as
(row_number - 1) * number_of_rows + column_number

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by