calling elements in matrix

13 visualizaciones (últimos 30 días)
sampath kumar punna
sampath kumar punna el 29 de Oct. de 2019
Respondida: Vinai Datta Thatiparthi el 5 de Nov. de 2019
31 31 31 31 31 31 31 31 31 31 31 31 31 31 31
42 42 42 42 42 42 42 42 42 42 42 42 42 42 42
21 21 21 21 20 20 20 20 21 21 21 21 20 20 20
19 19 34 34 19 19 34 34 19 19 34 34 19 19 34
6 9 6 9 6 9 6 9 6 9 6 9 6 9 6 9 6
if we have this huge matrix i have to call only this postions [3 4 6 9 ]
can i know how to do this
  1 comentario
Fabio Freschi
Fabio Freschi el 29 de Oct. de 2019
if you want to extract specific elements of a matrix you need the row and the col index. You provided only a vector. Which elements do you want to extract?

Iniciar sesión para comentar.

Respuestas (1)

Vinai Datta Thatiparthi
Vinai Datta Thatiparthi el 5 de Nov. de 2019
Hi Sampath!
As Fabio mentioned, you can use both the row and column indices to get values out of a matrix of any size. Else, if you give a vector as the index (like in your question), MATLAB returns the values at the positions mentioned in the vector from the input matrix, but column wise (since column-major is the default in MATLAB).
Hope this helps!

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by