Associate the value to the correct string

조회 수: 2 (최근 30일)
gcicceri
gcicceri 2020년 7월 9일
편집: gcicceri 2020년 7월 9일
Hi guys,
I have a (mxn) table:
table_1:
Date var_1 var_2 var_3 var_4
01-01-90 0.03 0 0.29 0
01-01-91 0.03 0.30 0.53 0.30
01-01-92 0.02 0.20 0.56 0.39
01-01-93 0.01 0.19 0.57 0.37
01-01-94 0.06 0.20 0.33 0.43
.........................................................................
.........................................................................
and a (mxn)string: (consider now the columns)
1 2 3
var_3 var_1 var_2
var_1 var_2 var_3
var_4 var_4 var_4
var_2 var_3 var_1
My question is:
how do I associate the value of next year (row) of the table_1 directly from the name of the string?
This should be the result:
table_3:
1 2 3
0.53 0.02 0.19
0.03 0.20 0.57
0.30 0.39 0.37
0.30 0.56 0.01
  댓글 수: 1
Image Analyst
Image Analyst 2020년 7월 9일
편집: Image Analyst 2020년 7월 9일
Are you wanting to know how to use sort() on each table row independently? Like sort the table with the 'var_n' strings in it, and then reshuffle the table with the numbers to use the same sort order as you got from the table with the strings?
Make it easy for us to help you by supplying us with code to generate the string table and the numbers table.

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

답변 (1개)

gcicceri
gcicceri 2020년 7월 9일
편집: gcicceri 2020년 7월 9일
I don't need to sort() the table, I just need to transfer the associated values of the column names to another table.
The table is the one you see. Also the result of how must be.

카테고리

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