How to find which columns are different between two tables

6 ビュー (過去 30 日間)
Curious Mind
Curious Mind 2018 年 8 月 12 日
コメント済み: Dankur Mcgoo 2018 年 8 月 21 日
Hello:
I have 2 datasets (Table A and Table B). Table A has 1200 columns while that of B has 1205 columns. They all have the same number of rows. A and B are supposed to be the same but for some reason when I save A, 5 additional columns are added hence I get B (1205 columns instead of 1200).
I wanna find out what those 5 additional columns are. Is there a code that can let me compare A and B and tell me what those additional 5 columns in Table B are?
Thank you and I look forward to hearing from you soon.
  3 件のコメント
Curious Mind
Curious Mind 2018 年 8 月 12 日
Unfortunately I don’t have the files with me now. I’m saving Table A as a .dat file. I’m using 2017a version. It works fine just happened today. Every time I save data A 5 additional columns of data are added and I wanna know what those 5 columns are.
Walter Roberson
Walter Roberson 2018 年 8 月 12 日
.dat is not a standard file type. How are you doing the saving?

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

採用された回答

Dankur Mcgoo
Dankur Mcgoo 2018 年 8 月 12 日
A = rand(3,3);
B = [A, rand(3,1)]; % Generating random tables
idx = ~ismember(B,A);
LookSee = B(idx);
LookSee should have the columns you want...
  2 件のコメント
Curious Mind
Curious Mind 2018 年 8 月 12 日
So since I have TableA and TableB would the code be like A = TableA; B = [A, TableB]; idx = ~ismember(B,A); LookSee = B(idx); ?
Dankur Mcgoo
Dankur Mcgoo 2018 年 8 月 21 日
Yup!

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

その他の回答 (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