How do i create a header-cell array with many values??

9 visualizaciones (últimos 30 días)
Alex
Alex el 27 de Nov. de 2014
Comentada: Image Analyst el 27 de Nov. de 2014
Hello everyone, I'm trying to create a cell array containing 1025 headers. Is there any way to do this with a for loop or something. Notice that every header must have a different name. For example i want to create this:
header = {'psb_1', 'psb_2',.......,'psb_1025'}
How can i do this except for doing it manually??

Respuesta aceptada

Guillaume
Guillaume el 27 de Nov. de 2014
With your particular example:
numheaders = 1025;
header = arrayfun(@(n) sprintf('psb_%d', n), 1:numheaders, 'UniformOutput', false);
  2 comentarios
Alex
Alex el 27 de Nov. de 2014
Thanks a lot!! That was exactly what i was looking for ;)
Image Analyst
Image Analyst el 27 de Nov. de 2014
Please go ahead and Vote for it and mark it as Accepted to give Guillaume "reputation points."

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical 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