How can i find indices of constant elements between 2 arrays?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Jiahong Zou
el 31 de Mayo de 2023
Comentada: Jiahong Zou
el 2 de Jun. de 2023
Hi, i have 2 enormous matrices A and B which are parameter relevant. With find() function i know which elements are non zero and with find(A-B) i know which elements are changed due to parameter. But how can i find out the indices of elements which remain constant?
4 comentarios
Jiahong Zou
el 31 de Mayo de 2023
Editada: Image Analyst
el 31 de Mayo de 2023
Image Analyst
el 31 de Mayo de 2023
Exactly how big are your arrays? Hundreds of millions of elements or more?
Respuesta aceptada
the cyclist
el 31 de Mayo de 2023
Do you mean the non-zero elements that are the same between the two arrays?
A = [1 2 0; 0 1 0; 5 0 8];
B = [1 3 0; 0 4 0; 5 0 6];
[r,c] = find(A==B & A~=0)
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!