How to rearrange String Data within table relative to one Column of Data.

1 回表示 (過去 30 日間)
Sai Gudlur
Sai Gudlur 2024 年 5 月 7 日
コメント済み: Voss 2024 年 5 月 7 日
Hello,
I have a table with 80X10. The first Variable (Var 1) has text Data, Variable 8 (Relavent Data), Variable 9 (parameter List), Variable 10 (GPP_Names). Var1 to Var8 Imported from File A and Var 9, Var10 (Parameter_List & Gpp_Names) Imported from another.
Both Contatinated (horzcat) and put together in one table Common_Data_1. As in the attached picture.
Var 1 & Var 9 (Parameter_List) are exactly same text. But I am unable to arrange it to match each other.
Var9 (Parameter_List) & Var 10 (Gpp_Names) are alligned Perfectly.
I would like to extract Var 1,Var8, Parameter_List,GPP_Names data that perfectly aligned.
1) Should I match the text pattern before Concatinating them into one Table?
2) How could I use sortrows or rowfun or other functions to arrange this data?
Any help or suggestion would be of great help.
Thanks
Sai

採用された回答

Voss
Voss 2024 年 5 月 7 日
"Should I match the text pattern before Concatinating them into one Table?"
You can do it that way, but since I don't know much about what the tables were before they were combined, I'll provide a way to start with your existing combined table Common_Data_1 and reorder Parameter_List and GPP_Names together such that Parameter_List is the same as Var1:
[~,idx] = ismember(Common_Data_1.(1),Common_Data_1.(9));
Common_Data_1(:,[9 10]) = Common_Data_1(idx,[9 10]);
  2 件のコメント
Sai Gudlur
Sai Gudlur 2024 年 5 月 7 日
Thanks a lot. it is straight forward could figure it. Thank you again
Voss
Voss 2024 年 5 月 7 日
You're welcome!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTables についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by