How to merge two table coulmns into one column?

3 vues (au cours des 30 derniers jours)
Kazi Alam
Kazi Alam le 16 Avr 2021
Commenté : Kazi Alam le 16 Avr 2021
I have tables T1 and T2 with same size. They hold double values. I would liket to merge T1.X = [1 ;2 ;3] and T2.X = [3 ;6; 7] and the result should be something like x = [13; 26; 37 ]. Is it possible? Used once strcat and returened with error message 'Complex values cannot be converted to chars'. Can someone help ?
  2 commentaires
Kazi Alam
Kazi Alam le 16 Avr 2021
Thank you. And if I have three coulmns, then?

Connectez-vous pour commenter.

Réponse acceptée

Matt J
Matt J le 16 Avr 2021
Modifié(e) : Matt J le 16 Avr 2021
T1=table([1;2;3],'VariableNames',{'X'});
T2=table([3;6;7],'VariableNames',{'X'});
x=str2double(string(T1.X)+string(T2.X))
x = 3×1
13 26 37
  1 commentaire
Kazi Alam
Kazi Alam le 16 Avr 2021
Thank you. This is easier to write the code but takes a little more time.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by