appending a column to a cell array

28 vues (au cours des 30 derniers jours)
gmltn1212
gmltn1212 le 4 Juil 2020
Réponse apportée : Voss le 4 Juil 2020
Hi I am trying to append a column to an existing cell array also with an additional header...
addthis = {1;2;3;4;5}
addheader = 'third col'
tothis = {'first col' 'second col'; 0, 0; 0, 0; 0, 0; 0, 0; 0, 0}
I want to return this
added = {'first col' 'second col' 'third col'; 0, 0, 1; 0, 0, 2; 0, 0, 3; 0, 0, 4; 0, 0, 5}

Réponses (1)

Voss
Voss le 4 Juil 2020
added = [tothis [addheader; addthis]];

Catégories

En savoir plus sur Cell Arrays 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