Concatenate String and Numbers Horizontally

3 vues (au cours des 30 derniers jours)
Amanda
Amanda le 19 Fév 2013
I have 3 columns of data: 1 string and 2 number
a = [ 'A';'B';'C'] b = [75; 85; 95] c = [89; 95; 58]
I am trying to horizontally concatenate a,b,c into one array of d. As seen below:
'A' 75 89
'B' 85 95
'C' 95 58
Some reason it is the combination of stings and numbers that is causing the problem.
Thanks, Amanda

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 19 Fév 2013
Modifié(e) : Azzi Abdelmalek le 19 Fév 2013
You should use a cell array
out=[cellstr(a) num2cell(b) num2cell(c)]

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices 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