How do I get the value at a particular index?
245 ビュー (過去 30 日間)
古いコメントを表示
So I have indices corresponding to values that I want. Is there a MATLAB function that would allow me to output the values when I input the indices of those values?
5 件のコメント
Luis J Gilarranz
2020 年 3 月 1 日
Walter Roberson
2020 年 3 月 1 日
Yes the techniques there are good, except I would not use the diag() one
回答 (1 件)
Siriniharika Katukam
2019 年 10 月 29 日
Hi
Consider A as the matrix, and x as indices, then
Values = A(x)
In case you need value of a 2-D matrix, define 'rowMatrix' which has the row indices and 'colMatrix' which has corresponding column indices, then
Values = A(rowMatrix, colMatrix)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!