How to add new cell array into a old struct

1 回表示 (過去 30 日間)
Chao Zhang
Chao Zhang 2021 年 6 月 28 日
編集済み: Stephen23 2021 年 6 月 28 日
HI ALL,
I wrote a cold for a old struct that STC_ORE is presented in the following picture
STC_ORE = struct('Group',str_ore,'Element',sub_ore);
STC_WASTE = struct('Group',str_waste,'Element',sub_waste);
I then create some new cell arrays and these attribute such as 'ORE_TON' (cell array, 9X1), 'X_CENT'(cell array, 9X1),'Y_CENT'(cell array, 9X1),'Z_CENT'(cell array, 9X1), I want to add these new attributes into the old strcut (STC_ORE and STC_WASTE) like the form of above picture i.e. 'Group' value, 'Element', value, 'ORE_TON', value, 'X_CENT', value,...., how to achieve it?

採用された回答

Stephen23
Stephen23 2021 年 6 月 28 日
編集済み: Stephen23 2021 年 6 月 28 日
[STC_ORE.ore_ton] = ORE_TON{:};
[STC_ORE.x_cent] = X_CENT{:};
[STC_ORE.y_cent] = Y_CENT{:};
[STC_ORE.z_cent] = Z_CENT{:};

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by