フィルターのクリア

How can I append a new cell onto the end of a Cell Array?

201 ビュー (過去 30 日間)
Alex Hughes
Alex Hughes 2020 年 4 月 28 日
編集済み: Gali 2023 年 1 月 8 日
Lets say I have a cell array C, with 1 column of different sized sub arrays (Example below)
C = {1x3 Cell};
{1x5 Cell};
{1x6 Cell};
Now lets say I have a new Cell F, and I want to append it to the end of Cell Array C.
F = {1x8 Cell};
I want to add F to C such that C looks like as follows:
C = {1x3 Cell};
{1x5 Cell};
{1x6 Cell};
{1x8 Cell}; % <--- This is Cell F
I want to do this to add new cells to the end of a primary cell array, without the need for loops. Is there any way to do this simply? I found a workaround by using length(CellArray) for the index position, but was hoping there would be an append() function or something.
  1 件のコメント
Gali
Gali 2023 年 1 月 8 日
編集済み: Gali 2023 年 1 月 8 日
I have similar case with more cell array in Group_1 of about 200cell, Group_2 = 50cell and Group_3 = 100cell. Basically I want to group them in the same place and then I can find the average of certain parameter. This is what I was trying but picking only the Group_1 and Group_2 and find the averages.
G_1 = (G{1,1}); %% string and number 1x150cell --- e.g (200X15 dataset, 500X15dataset, .........)
G_2 = (G{1,2}); %% string and number 1x50cell --- e.g (255X15 dataset, 25X15dataset, .........)
G_3 = (G{1,3}); %% string and number 1x100cell --- e.g (100X15 dataset, 50X15dataset, .........)
G_1_2 = [G_1; G_2];
also use G_1_2 = {G_1; G_2}
I want to combine G_1 and G_2 before calculating the aveage. Why is it working when G_1 and G_2 are numeric.
Thank very much

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

採用された回答

James Tursa
James Tursa 2020 年 4 月 28 日
編集済み: James Tursa 2020 年 4 月 28 日
If F really is a cell array in the format you list, then just
C(end+1) = F;
If not, then you may have to do this:
C(end+1) = {F};

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by