Creating a 3D-Matrix containing structures

7 ビュー (過去 30 日間)
Tobias Hahn
Tobias Hahn 2018 年 7 月 25 日
編集済み: Jan 2018 年 7 月 30 日
I'm trying to create a 3D Matrix, were every cell contains a pair of 2 structs.
First idea, not working
c = linspace(1e03,1e05,20);
d = linspace(1e04,1e10,20);
A = struc(100,20,20);
for ii= 2:2:100
for cc=1:20
for dd=1:20
RES = struc(ii,c(cc),d(dd));
FAL = struc(ii,c(cc),d(dd));
A(ii,c(cc),d(dd))=[RES(ii,cc,dd);FAL(ii,cc,dd)];
end
end
end
For example, RES(50,3,4) and FAL(50,3,4) shall both be saved in the cell (50,3,4) within A.
  3 件のコメント
Tobias Hahn
Tobias Hahn 2018 年 7 月 29 日
To be honest, i have no idea. Up untill now it somehow worked and i never questioned it, because i never had the time to do so.
Jan
Jan 2018 年 7 月 30 日
@Tobias Hahn: It is easy for you to find out, what struc is:
help struc
edit struc

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

回答 (1 件)

Jan
Jan 2018 年 7 月 26 日
Do you mean a cell array?
A = cell(100,20,20);
...
A{ii,c(cc),d(dd)} = [RES(ii,cc,dd);FAL(ii,cc,dd)];
^ ^ <== curly braces
  2 件のコメント
Tobias Hahn
Tobias Hahn 2018 年 7 月 29 日
Haven't heared of cell arrays until now, but i will try asap. Thanks a lot
Jan
Jan 2018 年 7 月 30 日
編集済み: Jan 2018 年 7 月 30 日
I recommend to read the Getting Started chapters of the documentations. Matlab's Onramp is fine also to learn the basics (and free of costs): https://matlabacademy.mathworks.com/

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

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by