Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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

1 visualización (últimos 30 días)
Sivasakthi R
Sivasakthi R el 11 de Ag. de 2017
Cerrada: MATLAB Answer Bot el 20 de Ag. de 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 comentario
Jan
Jan el 11 de Ag. de 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?

Respuestas (1)

Ahmed raafat
Ahmed raafat el 11 de Ag. de 2017
Editada: Ahmed raafat el 11 de Ag. de 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)

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by