Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
ismember runs too slow (others have asked similar questions)
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to use ismember in a long for loop to identify indices shared between arrays. This is pretty similar to a question that was asked here. Hopefully, an answer can be found for my question.
Below is my script that is taking far too long to run. I've included a sample of my workspace with the important variables.
Lcu =length(count_uni);
for i=1:Lcu
count = count_uni(i);
k = find(count_all==count);
% count = 1: 1 unique values
% count = 2: 2 unique values
% etc.
PosAllk = PosAllrep(k,:);
A_allk = A_all(k); PVTr_allk = PVTr_all(k);
count_allk = count_all(k);
if count>1
LPAk = length(PosAllk);
for j=1:LPAk
b = ismember(PosAllrep,PosAllk(j,:),'rows');
Aavg = mean(A_all(b)); Pavg = mean(PVTr_all(b));
g = ismember(PosAlluni,PosAllk(j,:),'rows');
TimeAvg = [TimeAvg;[PosAlluni(g,:),Aavg,Pavg,count]];
end
else
TimeAvg = [PosAllk,A_allk,PVTr_allk,count_allk];
end
end
0 comentarios
Respuestas (0)
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!