How to merge two table coulmns into one column?

조회 수: 1 (최근 30일)
Kazi Alam
Kazi Alam 2021년 4월 16일
댓글: Kazi Alam 2021년 4월 16일
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 ?

채택된 답변

Matt J
Matt J 2021년 4월 16일
편집: Matt J 2021년 4월 16일
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
Kazi Alam
Kazi Alam 2021년 4월 16일
Thank you. This is easier to write the code but takes a little more time.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by