How do I add a string to a cell?

126 vues (au cours des 30 derniers jours)
John
John le 28 Oct 2015
Commenté : John le 28 Oct 2015
I have a 1x4 cell array containing strings, that I got using [num,txt]=xlsread(...). Now I would like to add another string, so that it becomes a 1x5 cell array, so that I can use it as column legends for a 5x5 numeric array that I will export with xlswrite. How can I add that string?

Réponse acceptée

Thorsten
Thorsten le 28 Oct 2015
C{1,5} = 'newstring';
  1 commentaire
John
John le 28 Oct 2015
Thanks

Connectez-vous pour commenter.

Plus de réponses (1)

Jan
Jan le 28 Oct 2015
C{end + 1} = 'newstring';
Or:
C = cat(2, C, {'newstring'}); % Less efficient
  1 commentaire
John
John le 28 Oct 2015
Thanks

Connectez-vous pour commenter.

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