You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
605 B
22 lines
605 B
% get the connectClusterIDX for clusterIDX
|
|
% K * 4 * (K-1):
|
|
% For K clusters:
|
|
% for 4/8 dirs:
|
|
% if connect to the other (K-1) clusters
|
|
function connClusterIDX = connectClusterIDX(connectEle, clusterIDX, K, optNeighbor)
|
|
|
|
connClusterIDX = zeros(K, optNeighbor, K-1);
|
|
|
|
eleNums = size(connectEle,1);
|
|
for i = 1:eleNums
|
|
ci = clusterIDX(i,1);
|
|
|
|
conn = connectEle(i,:);
|
|
for j = 1:optNeighbor
|
|
if conn(j)>0
|
|
cj = clusterIDX(conn(j),1);
|
|
connClusterIDX(ci,j,cj) = 1;
|
|
end
|
|
end
|
|
end
|
|
end
|