How to compare two xcel worksheets?

12 views (last 30 days)
Manjuladevi Subbareddy
Manjuladevi Subbareddy on 24 Feb 2021
Answered: Kautuk Raj on 3 Jun 2023
I Need to compare two xcel work sheets from customer and our data results.
Im a new one to matlab please send a link or code for me.

Answers (1)

Kautuk Raj
Kautuk Raj on 3 Jun 2023
To compare two Excel worksheets in MATLAB, we can use the readtable function to read each worksheet into a table, and then use the table functions to compare the contents of the tables.
This is some example code that demonstrates how to compare two Excel worksheets in MATLAB:
% Read the first worksheet into a table
filename1 = 'worksheet1.xlsx';
sheet1 = 'Sheet1';
T1 = readtable(filename1, 'Sheet', sheet1);
% Read the second worksheet into a table
filename2 = 'worksheet2.xlsx';
sheet2 = 'Sheet1';
T2 = readtable(filename2, 'Sheet', sheet2);
% Compare the two tables
if isequaln(T1, T2)
disp('The two worksheets have the same contents.');
else
disp('The two worksheets have different contents.');
end
We then use the isequaln function to compare the two tables. Note that if the two tables have different sizes or data types, the isequaln function will return false, even if their contents are the same. In such cases, we may need to use other functions, such as isequal, isequalwithequalnans, or equiv, depending on our specific requirements. Additionally, we can preprocess the tables to remove any irrelevant or inconsistent data before comparing them.

Categories

Find more on Data Import from MATLAB in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!