How do I get the value at a particular index?
123 次查看(过去 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?
回答(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!