Convert structure to vector

115 visualizzazioni (ultimi 30 giorni)
Gina Torres
Gina Torres il 9 Lug 2018
Commentato: Gina Torres il 9 Lug 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?

Risposta accettata

Adam
Adam il 9 Lug 2018
vertcat( M.vector )

Più risposte (0)

Categorie

Scopri di più su Structures in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by