How to add columns to cell array

6 次查看(过去 30 天)
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
[cells repmat({'-'},3,2)]

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Types 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by