Convert structure to vector

127 visualizaciones (últimos 30 días)
Gina Torres
Gina Torres el 9 de Jul. de 2018
Comentada: Gina Torres el 9 de Jul. de 2018
Hello all,
I'm working with data in a structure type. For example:
M(1).vector=[0.3966;0.0829]
M(2).vector=0.87537
M(3).vector=0.64707
M(4).vector=[0.50874;0.04913;0.39537;0.27546;0.5889;0.61199;0.61578;0.78747;0.75151]
The Data for each row within the structure are small vectors as shown (Actually my structure has more than 1000 rows). I have this information separated like this because to each row I needed to apply different calculations. But now that all the calculations are done, I want to have this data as a 1 column vector. I have tried using something like cell2mat(struct2cell(M)) but I get errors.
The result that I'm looking for should look like this:
Result=[0.3966;0.0829;0.87537;0.64707;0.50874;0.04913;0.39537;0.27546;0.5889;0.61199;0.61578;0.78747;0.75151]
Any suggestions?

Respuesta aceptada

Adam
Adam el 9 de Jul. de 2018
vertcat( M.vector )

Más respuestas (0)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by