How to convert a matrix into a vector

292 visualizaciones (últimos 30 días)
praveen
praveen el 7 de En. de 2018
Respondida: M Shujah Islam Sameem el 5 de En. de 2019
I have a matrix and i need to convert it into a vector. Basically i need to remove the dependency of one parameter.Please see the image file i have attached.

Respuesta aceptada

Star Strider
Star Strider el 7 de En. de 2018
You did not state the result you want. One obvious option is to use the reshape (link) function.
  5 comentarios
praveen
praveen el 9 de En. de 2018
Hello Star Strider this is exactly the concept i was looking for. I tried this and it gave me a single column vector but with reduced number of rows.If you look at the image i posted in the question the output will have equal number of rows when compared to the input.Please let me know if a modified SVD or any other similar concept is capable of doing this. Thank you very much for the answer.
Star Strider
Star Strider el 9 de En. de 2018
If the mathematics are not important and any procedure will do, the easiest approach would likely be something like:
Result = mean(A,2,'omitnan')
where ‘A’ is your matrix.

Iniciar sesión para comentar.

Más respuestas (1)

M Shujah Islam Sameem
M Shujah Islam Sameem el 5 de En. de 2019
%%%% Converting Matix to vector
A = [1 2 3; 4 5 6; 7 8 9] % Example matrix
reshape(A,[],1) % convert matrix to column vector
reshape(A,1,[]) % convert matrix to row vector

Categorías

Más información sobre Logical 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