Outputting information from a loop

2 ビュー (過去 30 日間)
RP
RP 2022 年 4 月 5 日
コメント済み: RP 2022 年 4 月 5 日
Any ideas as to output all combinations of i and j. Each combination is a vector of size 9*1. Table 2 is a cell array.
for i=1:4
for j=1:4
C=Table2(i,j);
axes_mat=vertcat(C{:});
D=cell2mat(axes_mat);
D=reshape(D,[9,1]);
end
end
  3 件のコメント
RP
RP 2022 年 4 月 5 日
I have attached Table 2. This is a cell array with 16 cells each with dimensions 1*1*9.
I need to take the same element from each array (e.g. the second entry) and construct a matrix of dimensions 9*16
RP
RP 2022 年 4 月 5 日
The output should be a matrix as opposed to a cell array.

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

回答 (1 件)

Jan
Jan 2022 年 4 月 5 日
What about:
D = cat(2, Table2{:});

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by