How to compare two different excel sheets specific columns for like values

20 次查看(过去 30 天)
I am trying to compare two excel files, specifically a column in each. The cells contain numbers and letters and arent in order. I am trying to update a condensed list to ensure that it has the master's values. It has been a few years since ive used MATLAB. I tried using the setdiff function to compare arrays from each with no luck. TIA!
  7 个评论
Voss
Voss 2022-1-21
I thought you want to find out which values in the full list aren't in the condensed list:
C = A(~ismember(A,B)); % Full list elements not in Condensed list
rtather than which values in the condensed list aren't in the full list:
D = B(~ismember(B,A)); % Condensed list elements not in Full list

请先登录,再进行评论。

回答(1 个)

Ive J
Ive J 2022-1-22
xlsread is deprecated, avoid it.
fullTab = readtable('File1.xlsx');
denseTab = readtable('File2.xlsx');
[idxFull, idxDense] = ismember(fullTab.(13), denseTab.(3));
idxDense(idxDense < 1) = [];
fullCol13Unique = A.(13)(~idxFull);

类别

Help CenterFile Exchange 中查找有关 Data Import from MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by