Associate the value to the correct string

1 次查看(过去 30 天)
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