How to append a new element to a cell object A?

1,506 ビュー (過去 30 日間)
fan feng
fan feng 2015 年 6 月 8 日
回答済み: geofo 2021 年 12 月 3 日
>>A={'a';'b'};
I want to append a new element,say 'c', to A, how could I do?
I would appreciate if you could help me.

採用された回答

Walter Roberson
Walter Roberson 2015 年 6 月 8 日
A{end+1} = c;
  6 件のコメント
Christopher Davis
Christopher Davis 2021 年 1 月 10 日
That's really helpful, not sure if it's proper terminology but I've heard this refered to as prepend
Pedro Miranda Pinheiro
Pedro Miranda Pinheiro 2021 年 9 月 14 日
Thank you, @Walter Roberson! @Christopher Davis, prepend is used for insertion of an element in the begining of a data structure. Append is the one used for end insertion as mentioned above.

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

その他の回答 (1 件)

geofo
geofo 2021 年 12 月 3 日
>> A=[A;'c'];

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by