フィルターのクリア

concatenate doubles of different sizes in a cell array into one double

18 ビュー (過去 30 日間)
Haneya Qureshi
Haneya Qureshi 2021 年 12 月 14 日
コメント済み: Walter Roberson 2021 年 12 月 14 日
I have a cell of 1 x 3
Each of 3 elements in that cell are of different sizes in rows. Columns of all 3 are same size.
Like:
1st element is a x 2
2nd element is b x 2
3rd element is c x 2
I want their concatenation, like a double with size (a+b+c) x 2

採用された回答

Voss
Voss 2021 年 12 月 14 日
my_cell = {rand(4,2) rand(7,2) rand(10,2)}; % make up some data reflecting your situation
my_matrix = vertcat(my_cell{:}); % vertically concatenate the cells of my_cell, resulting in a matrix
  1 件のコメント
Walter Roberson
Walter Roberson 2021 年 12 月 14 日
my_cell = {rand(4,2) rand(7,2) rand(10,2)}; % make up some data reflecting your situation
my_matrix = cell2mat(my_cell(:));
size(my_matrix)
ans = 1×2
21 2
cell2mat() is a convenience function that can extract from cell arrays into a matrix.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by