Retrieving data from a structure

1 回表示 (過去 30 日間)
Inti Vanmechelen
Inti Vanmechelen 2016 年 11 月 5 日
コメント済み: Inti Vanmechelen 2016 年 11 月 5 日
Hi,
I have a 1x36 structure with 34 fields called Dat_store. The first field contains 36 times a 1x4 vector with information on com: K4_com. Now I'd like to extract this CoM data and create a 36x4 matrix one value of the 1x4 vector in each column of the matrix. I tried
K4_COM = [Dat_store_12().K4_com];
But that gives me a 1x144 vector, which is not what I want.
Does anybody know what the correct command should be?
Thanks

採用された回答

Guillaume
Guillaume 2016 年 11 月 5 日
K4_COM = vertcat(Dat_store_12.K4_com)
is the correct syntax (yours was equivalent to horzcat(Dat_store_12.K4_com) hence why they were all concatenated in a row).
  1 件のコメント
Inti Vanmechelen
Inti Vanmechelen 2016 年 11 月 5 日
Thanks!

サインインしてコメントする。

その他の回答 (1 件)

KSSV
KSSV 2016 年 11 月 5 日
K4_COM = [Dat_store_12().K4_com];
iwant = reshape(K4_COM,4,[])' ;

カテゴリ

Help Center および File ExchangeUse COM Objects in MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by