Borrar filtros
Borrar filtros

creating a cell with serial names

1 visualización (últimos 30 días)
Binu
Binu el 18 de Jun. de 2019
Comentada: Stephen23 el 20 de Jun. de 2019
Hello,
I want to create a list (1x15 cell) of 15 names (sometimes more than that) with names of following pattern;
AB_01, AB_02, AB_03,....AB_15.
Is there an easy way to do this , in a loop like, rather than type it each.
Thanks

Respuesta aceptada

Akira Agata
Akira Agata el 18 de Jun. de 2019
How about the following?
suffix = repmat({'AB_'},15,1);
number = cellstr(num2str((1:15)','%02d'));
output = strcat(suffix,number)';
  3 comentarios
madhan ravi
madhan ravi el 18 de Jun. de 2019
even simpler:
compose('AB_%02d',(1:15)') % >=2016b
Stephen23
Stephen23 el 20 de Jun. de 2019
darshani Thotagamuwage's incorrectly accepted "Answer" moved here:
It worked very well. Thanks a lot

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by