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

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 日

3 投票

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 件)

カテゴリ

ヘルプ センター および File ExchangeEntering Commands についてさらに検索

タグ

質問済み:

2014 年 11 月 27 日

コメント済み:

2014 年 11 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by