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

조회 수: 1,573 (최근 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 CenterFile Exchange에서 Structures에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by