How to add an element to cell?

조회 수: 2 (최근 30일)
John
John 2021년 1월 19일
댓글: John 2021년 1월 20일
There is an existing cell like:
the_cell={'January','March','April'}
the_cell =
1×3 cell array
{'January'} {'March'} {'April'}
How to add an element into this 1x3 cell to make it 1x4 cell like:
the_cell =
1×4 cell array
{'January'} {'February'} {'March'} {'April'}
Thanks.

채택된 답변

per isakson
per isakson 2021년 1월 19일
One way
>> the_cell={'January','March','April'};
>> the_cell = cat( 2, the_cell(1), {'February'}, the_cell(2:end ) )
the_cell =
1×4 cell array
{'January'} {'February'} {'March'} {'April'}
  댓글 수: 1
John
John 2021년 1월 20일
Silly me forgot the cat function. Thanks.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Report Generator에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by