フィルターのクリア

Insert values of arrays in another cell array

2 ビュー (過去 30 日間)
Eli Dim
Eli Dim 2015 年 6 月 30 日
コメント済み: Eli Dim 2015 年 6 月 30 日
I have the following problem. In the attached picture I three columns of cells. My goal is to append the 2nd and 3rd column inside the first column. So in the end I will end up with only one column and the size of all cells inside will be rows x 19 double. where the 18th column comes from my original column2 and the 19th column comes from my original column3. How can I do this?

採用された回答

Guillaume
Guillaume 2015 年 6 月 30 日
編集済み: Guillaume 2015 年 6 月 30 日
Use a loop (or arrayfun):
result = cell(size(gencostSorted_New, 1), 1);
for row = 1 : size(gencostSorted_New)
result{row} = [gencostSorted_new{row, :}];
end
Or
result = arrayfun(@(row) [gencostSorted_new{row, :}], 1:size(gencostSorted_new), 'UniformOutput', false);
The clever bit is the [gencostSorted_New{row, :}] which concatenate all the cells of a row into a matrix.
  1 件のコメント
Eli Dim
Eli Dim 2015 年 6 月 30 日
Thank you very much!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by