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 Center および File ExchangeMATLAB Report Generator についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by