How to rearrange String Data within table relative to one Column of Data.
조회 수: 1 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
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]);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!