フィルターのクリア

How do I combine data tables where there are different row lengths?

8 ビュー (過去 30 日間)
Amy Hughes
Amy Hughes 2019 年 12 月 14 日
コメント済み: Ridwan Alam 2019 年 12 月 14 日
From my cell arrays, I have converted each output into a table in matlab which I have attached as excel files for clarity ( I could not convert the cell outputs into character vectors of different lengths, so made them into tables instead).
Expected removal table contains 61 rows and 1 column (T1 in matlab)
Kept table contains 45 rows and 1 column (T2 in matlab)
Deleted table contains 16 rows and 1 column (T3 in matlab)
Please find attached my data.
How would I go about combining these tables together, when I want the rownames to align, and then the rest of the cells contain NaN or NA when they don't. I have attached an excel file with this done (combined_expect_kept_deleted). However, I need code to automate this.
If I could have converted the data into three separate character vectors, I would have used padcat to concatenate the vectors of different lengths, using NaNs etc. But my cell2mat does not work, and not sure how else to get the output into character vector format from a cell.
Does anybody have any suggestions please?

採用された回答

Ridwan Alam
Ridwan Alam 2019 年 12 月 14 日
T1(ismember(table2array(T1(:,1)),table2array(T2)),2) = T2;
T1(ismember(table2array(T1(:,1)),table2array(T3)),3) = T3;
  2 件のコメント
Amy Hughes
Amy Hughes 2019 年 12 月 14 日
Thank-you very much.
Ridwan Alam
Ridwan Alam 2019 年 12 月 14 日
Sure. Glad to help!

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by