Home Vectorizing for loop on square matrix in matlab
Reply: 0

Vectorizing for loop on square matrix in matlab

user377
1#
user377 Published in June 23, 2018, 2:28 am

I have a big square matrix (refConnect) with approx 500000 elements. I need to perform this operation:

tmp = find(referenceCluster == 67);
for j=1:length(tmp)
    refConnect(tmp(j),tmp)=1;
end

I wonder if there is a simple way to vectorise this so I can avoid the for loop which is taking forever. Thanks for any help. Cheers

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.324007 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO