Split a matrix of nodes (x,y,z) into 2/3 matrices with dbscan or spectralcluster
Hi! I should split the matrix ‘M4_5’ or ‘M4_12’ into 2/3 matrices like figure.
I have tried the functions ‘dbscan’ or ‘spectralcluster’ but I cannot subdivide the matrix.
load M4_5.mat
% load M4_12.mat
idx = dbscan(M4,0.3,4);
% idx = spectralcluster(M4,2);
[r1,c] = find(idx == 1);
[r2,c] = find(idx == 2);
M4_a = M4(r1,:);
M4_a = M4(r2,:);
figure
plot3(M4(:,1),M4(:,2),M4(:,3),’k.’,’Markersize’,8);
hold on
plot3(M4_a(:,1),M4_a(:,2),M4_a(:,3),’y.’,’Markersize’,12);
plot3(M4_a(:,1),M4_a(:,2),M4_a(:,3),’m.’,’Markersize’,12);
hold off
axis equalHi! I should split the matrix ‘M4_5’ or ‘M4_12’ into 2/3 matrices like figure.
I have tried the functions ‘dbscan’ or ‘spectralcluster’ but I cannot subdivide the matrix.
load M4_5.mat
% load M4_12.mat
idx = dbscan(M4,0.3,4);
% idx = spectralcluster(M4,2);
[r1,c] = find(idx == 1);
[r2,c] = find(idx == 2);
M4_a = M4(r1,:);
M4_a = M4(r2,:);
figure
plot3(M4(:,1),M4(:,2),M4(:,3),’k.’,’Markersize’,8);
hold on
plot3(M4_a(:,1),M4_a(:,2),M4_a(:,3),’y.’,’Markersize’,12);
plot3(M4_a(:,1),M4_a(:,2),M4_a(:,3),’m.’,’Markersize’,12);
hold off
axis equal Hi! I should split the matrix ‘M4_5’ or ‘M4_12’ into 2/3 matrices like figure.
I have tried the functions ‘dbscan’ or ‘spectralcluster’ but I cannot subdivide the matrix.
load M4_5.mat
% load M4_12.mat
idx = dbscan(M4,0.3,4);
% idx = spectralcluster(M4,2);
[r1,c] = find(idx == 1);
[r2,c] = find(idx == 2);
M4_a = M4(r1,:);
M4_a = M4(r2,:);
figure
plot3(M4(:,1),M4(:,2),M4(:,3),’k.’,’Markersize’,8);
hold on
plot3(M4_a(:,1),M4_a(:,2),M4_a(:,3),’y.’,’Markersize’,12);
plot3(M4_a(:,1),M4_a(:,2),M4_a(:,3),’m.’,’Markersize’,12);
hold off
axis equal dbscan, spectralcluster, data, matrix array, matrix manipulation, matrix, matrices MATLAB Answers — New Questions