How to add columns to cell array

6 vues (au cours des 30 derniers jours)
Neville
Neville le 22 Oct 2013
Commenté : Neville le 22 Oct 2013
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?

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 22 Oct 2013
[cells repmat({'-'},3,2)]
  1 commentaire
Neville
Neville le 22 Oct 2013
Wow it works. Thanks Azzi.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Types dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by