Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

how to merge 2 excel files to get different values as result

1 vue (au cours des 30 derniers jours)
Sivasakthi R
Sivasakthi R le 11 Août 2017
Clôturé : MATLAB Answer Bot le 20 Août 2021
i need to merge 2 excel files which are having different values. if their any existence of similar values. the results has to get display.
  1 commentaire
Jan
Jan le 11 Août 2017
Please post more details. Currently it is not possible to answer this. Do you really mean Excel files? Or are you able to import the data alreadfy to Matlab?

Réponses (1)

Ahmed raafat
Ahmed raafat le 11 Août 2017
Modifié(e) : Ahmed raafat le 11 Août 2017
simple method is to read and save the two excels in 2 variables
x1=xlsread('Sheet1.xls');
x2=xlsread('sheet2.xls');
if size(x1,1)==size(x2,1) % check if thy have same rows
if size(x1,2)==size(x2,2) % check if they have same coulmns
z=x1-x2;
r=find(z==0); % find values that equals zero
zx=z(r); % choose them
disp(z) % display them
end
end
or if size of x1 and x2 not equal
same_values=[];
for i=1:size(x1,1)
for j=1:size(x2,2);
r=find(x2==x1(i,j));
if length(r)>0
same_values(end+1)=x1(i,j);
end
end
end
disp(same_values)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by