What is M(I) where M is a real matrix and I is a matrix of indices.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
David Epstein
am 22 Jul. 2018
Beantwortet: Stephen23
am 22 Jul. 2018
M is a 67x67 matrix of doubles. I is a 441x2 matrix, with I = [xc,yc]. Each row is a pair i,j of indices of M. I want to apply M to I and get a vector of 441 doubles. However, M(xc,yc) gives a matrix of size 441x441 and M([xc,yc]) gives a matrix of size 441x2. I think both results give only zeros. Does anyone know what is happening, as there is no error message? The only thing I can think of is to convert to linear indices. Is that the only way?
0 Kommentare
Akzeptierte Antwort
Stephen23
am 22 Jul. 2018
"The only thing I can think of is to convert to linear indices. Is that the only way?"
Yes. Use sub2ind.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!