How to add an element to cell?

4 visualizaciones (últimos 30 días)
John
John el 19 de En. de 2021
Comentada: John el 20 de En. de 2021
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.

Respuesta aceptada

per isakson
per isakson el 19 de En. de 2021
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 comentario
John
John el 20 de En. de 2021
Silly me forgot the cat function. Thanks.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB Report Generator en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by