improve growing cell array in matlab -


I would like to know how to basically do what I aim to run this part of my program efficiently For his background, I want the cluster points. There are about 10,000 points. These points have been calculated among those "those people" stored in the matrix F , then the force between point 1 and point 2 is F (1,2) . I want to do "cluster points" with enough F to work on them (Force Setting / Threshold), which is 2 points with enough F both of them Are related to the same cluster between

I have a code as seen below. If a cell array CLUSTER was created to include the cluster assignment, then CLUSTER {i} is in the cell containing the i cluster digit

However, for some F settings, the implementation takes forever I have read about the rehearsal and front ( Perforof can not be done since iteration in iterations). But prealloclication of cell array means that individual cells are not undone with memory? Is there any other way around this? The framework tells me that the biggest part of computing is ismember . I hope to improve the code with your suggestions Thank you very much!

  CLUSTER = {}; For Fi = 1: fields for FO = 1: If the score is FJ & gt; If F (Fi, FJ) & gt; = 2000% to install force if ((~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~, cluster)) & amp; (~ Member (1, selphon (@ (x) member (fj, x), cluster)))% Fwice & amp; FJ Cluster is not in the client {end + 1} = [fi fj]; If the end %% ((Member (1, Sulfon (@ (x) member (fi, x), cluster) & amp; (member (1, cellphone (@ (x) member (fj, x), cluster) ))% F & amp; FJ is not in CLUSTER% because LFI and FJ CLUSTER %% are in the end if ((Member (1, Cellphone (@ (x) member (fi, x), CLUSTER) & amp; Amp; amp; (~ ismember (1, cellphone (@ (x) member (fj, x), cluster ()))% foil in cluster, CLSER C = not in search (cellphone (@ (x) member (fi , X), cluster)); cluster {c} } = [CLUSTER {c} fj]; end (if ~ ~ ~ ~ ~ ~ (1, cellphone (@ (x) member (fi, x), CLUSTER) & amp; (member (1, cellphone (@ (X) Member (FJ, X), cluster))) CLUSTER% FI, FJ = address in CLUSTER C (cellphone (@ (x) member (fj, x), cluster)); cluster {c} = [ CLUSTER {c} fi] Finally end of end  

I'm not sure This is the best way, but my idea is that it is possible to do some sort of update algorithm. Start 1. node to go to the cluster with nodes 1,

  Clstrdabrnbr = find (F (1,:)> gt; = 2000); (A)  

This will give you the node number for all nodes clustered with node 1. Then find all the nodes which can be added to the same vectors for Nodes clusteredNBR again (a) for all new nodes, such as clusteredNBR < Old codes in / code> You can have some duplicates here, but they can be deleted later. Then check the new unique nodes in this resultant vector. If any, repeat (a) for them until you first search all the nodes in the cluster. So you know that any nodes in the first cluster are not clustered with others.

Repeat this process for the next cluster and so on. The advantage with this is that you use ismember instead of find and this operation can be vectored, which allows you to run only for one loop .


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -