Division of a vector

조회 수: 3 (최근 30일)
massimiliano de martino
massimiliano de martino 2019년 9월 10일
댓글: darova 2019년 9월 11일
Goodmorning,
I would like to have help about that question: i've a vector which rapresents different zones in a 2D space.Main problem is that coordinates of differents zone are all togheter in one single vector,whereas i would like to have one different vector for each zone.
Attached i've reported two images which represent current situation:
  • In image 1 - i've reported current situation, in which i've one single vector with the coordinate of the four zones
  • In image 2 - i've reported desired situation, in which i've one vector for each zone.
I would like to know if there is a commande which is able to split vector,recognize different zones.
Attached a SavedWorkspace with one coordinate example, which can be used with following line code to plot the situation.
figure(1);grid on;hold on;
scatter(Zone_1_Overlap_Complete_Not_Zeros(:,1),Zone_1_Overlap_Complete_Not_Zeros(:,2),2);
hold off
  댓글 수: 2
Matt J
Matt J 2019년 9월 10일
In your example, the zones all appear to be convex. Will this always be the case?
massimiliano de martino
massimiliano de martino 2019년 9월 11일
Goodmorning,
It could happen that some of these zones can not be convex but concave.

댓글을 달려면 로그인하십시오.

채택된 답변

darova
darova 2019년 9월 10일
Try clusterdata()
load WorkSpace
X = Zone_1_Overlap_Complete_Not_Zeros(:,1);
Y = Zone_1_Overlap_Complete_Not_Zeros(:,2);
idx = clusterdata([X Y],'maxclust',4);
scatter(X,Y,3,idx,'filled')
See also kmeans()
  댓글 수: 2
massimiliano de martino
massimiliano de martino 2019년 9월 11일
Thanks so much,it work perfectly.
Thanks for your support
darova
darova 2019년 9월 11일
You are welcome

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Fractals에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by