cell array to matrix

2 ビュー (過去 30 日間)
Busy Bee
Busy Bee 2018 年 2 月 4 日
コメント済み: Busy Bee 2018 年 2 月 4 日
I have a cell array with 4 elements.Each with 2*2 dimensions. I want to create an 8*2 matrix with these cell arrays. I can do it as p_all=[p{1};p{2};p{3};p{4}] but it will be in a loop and I will not the know the number of elements beforehand although all the elements will be 2*2. Any suggestions?
p{1} =
89 62
89 166
p{2} =
132 167
132 208
p{3} =
113 208
113 281
p{4} =
64 281
64 320

採用された回答

Stephen23
Stephen23 2018 年 2 月 4 日
編集済み: Stephen23 2018 年 2 月 4 日
Assuming that the sizes are compatible you can easily use a comma-separated list:
vertcat(p{:})
  1 件のコメント
Busy Bee
Busy Bee 2018 年 2 月 4 日
yes. That worked. Thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by