combination of tables across columns

조회 수: 1 (최근 30일)
Legally Blonde
Legally Blonde 2020년 10월 25일
댓글: Legally Blonde 2020년 10월 25일
Hello, I have one table with the example values below:
Time1 Time2 Time3
'00:10' '00:10' '00:10'
'00:20' '00:20' '00:20'
'00:30' '00:30' '00:30'
'00:40' '00:40' '00:40'
'00:50' '00:50' '00:50'
And a second table with values:
Precipitation1 Precipitation2 Precipitation3
0,16 0 0,01
0,05 0,42 0,27
0,05 0,02 0,18
0,20 0 0,11
0,26 0 0,4
I'm looking for a combination of tables across columns that will look like:
Time1 Precipitation1 Time2 Precipitation2 Time3 Precipitation3
'00:10' 0,16 '00:10' 0 '00:10' 0,01
'00:20' 0,05 '00:20' 0,42 '00:20' 0,27
'00:30' 0,05 '00:30' 0,02 '00:30' 0,18
'00:40' 0,20 '00:40' 0 '00:40' 0,11
'00:50' 0,26 '00:50' 0 '00:50' 0,4
Thanks!!!

채택된 답변

Stephen23
Stephen23 2020년 10월 25일
Where T1 and T2 are your two tables:
T = [T1,T2];
T = T(:,[1,4,2,5,3,6])
  댓글 수: 1
Legally Blonde
Legally Blonde 2020년 10월 25일
Thank you so much for the quick answer! It work! How simple. :-)

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

추가 답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 10월 25일
Here T1 and T2 are two tables in your question
T = [T1 T2];
T = [T(:,1:size(T1,2):end) T(:,2:size(T1,2):end)]
  댓글 수: 1
Legally Blonde
Legally Blonde 2020년 10월 25일
Thank you so much for the quick answers, it work! :-)

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

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by