Vertical concatenation of 8 table with identical rownames

6 views (last 30 days)
So I am having a hard time to figure out this problem.
I have 8 tables, which each have a size of 65x3. The 65 rows have the same names in the same order on all 8 tables. When I try to combine them with vertical concatenation an error occurs, stating that I cannot concatenate tables with identical rownames. How can i solve this Problem? I haven't found a convienient way to automaticaly change the tables rownames to unique values.
Is there a function that automatically renames identical rownames?
I hope someone can help me. If you need any more information just tell me.
Thank you :)

Accepted Answer

Image Analyst
Image Analyst on 4 Dec 2022
I don't think you can just vertically stitch them together because you are using row names. What are the row names? Do you really need them? If not get rid of them.
Otherwise to combine you can't just stitch them together. I think you'd have to combine as a function of row name so that each row name in the combined table would be a vector of 8 values.
If the values are just numbers and you want to ignore the row names, you can convert to a matrix and just stitch them together
m1 = table2array(t1);
m2 = table2array(t2);
m3 = table2array(t3);
m4 = table2array(t4);
m5 = table2array(t5);
m6 = table2array(t6);
m7 = table2array(t7);
m8 = table2array(t8);
combinedt = [m1; m2; m3; m4; m5; m6; m7; m8]
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
  1 Comment
Marcel-Maximilian
Marcel-Maximilian on 4 Dec 2022
Hey thanks for your answer i did not think of that. That should solve my problem.
Thank you very much. :)

Sign in to comment.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!