Borrar filtros
Borrar filtros

How to compare two xcel worksheets?

3 visualizaciones (últimos 30 días)
Manjuladevi Subbareddy
Manjuladevi Subbareddy el 24 de Feb. de 2021
Respondida: Kautuk Raj el 3 de Jun. de 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.

Respuestas (1)

Kautuk Raj
Kautuk Raj el 3 de Jun. de 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.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by