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

조회 수: 9 (최근 30일)
Alex
Alex 2014년 11월 27일
댓글: Image Analyst 2014년 11월 27일
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??

채택된 답변

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

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by