How to add columns to cell array

I have this cell array:
cells =
'a' 'b' 'c'
'd' 'e' 'f'
'g' 'h' 'i'
What I want to do is add 2 columns with '-' in them.
cells =
'a' 'b' 'c' '-' '-'
'd' 'e' 'f' '-' '-'
'g' 'h' 'i' '-' '-'
Is it possible to do it dynamically depending on the number of rows?

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 10 月 22 日

1 投票

[cells repmat({'-'},3,2)]

1 件のコメント

Neville
Neville 2013 年 10 月 22 日
Wow it works. Thanks Azzi.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeOperators and Elementary Operations についてさらに検索

質問済み:

2013 年 10 月 22 日

コメント済み:

2013 年 10 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by