Azzera filtri
Azzera filtri

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

1.140 visualizzazioni (ultimi 30 giorni)
>>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.

Risposta accettata

Walter Roberson
Walter Roberson il 8 Giu 2015
A{end+1} = c;
  6 Commenti
Christopher Davis
Christopher Davis il 10 Gen 2021
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 il 14 Set 2021
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.

Accedi per commentare.

Più risposte (1)

geofo
geofo il 3 Dic 2021
>> A=[A;'c'];

Categorie

Scopri di più su Structures in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by