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-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 个评论
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