common data in two arrays

1 visualización (últimos 30 días)
Lakshmi Chodavarapu
Lakshmi Chodavarapu el 26 de Ag. de 2021
Editada: Lakshmi Chodavarapu el 26 de Ag. de 2021
I have one array(c ) of 30Kx15 sixe and one structure array(r.data), 25Kx19 size. Need to find rows with similiar coloumn data from both arrays and join them. in a particular order. Using the following code. But found its too time taking. Can someone suggest effiicient code please
k=1;
for i=1:length(r.data)
for j=1:length(cdataf)
if(r.data(i,3:9)==c(j,3:9))
finaldata(k,:)=[c(j,1:9) r.data(i,10:13) c(j,10:15)];
k=k+1;
end
end
end
  4 comentarios
Ive J
Ive J el 26 de Ag. de 2021
what about this tiny modification?
[loc, lor] = ismember(cdataf(:, 3:9), r.data(:, 3:9), 'rows');
rd = r.data(lor(loc), 3:9);
Lakshmi Chodavarapu
Lakshmi Chodavarapu el 26 de Ag. de 2021
Many thanks. It worked out well. Grateful to you.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Structures en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by