I can not find important function

hi, I found the following code of matlab in this link http://www.ideal.ece.utexas.edu/~gjun/ee379k/html/clustering/hac/page2.html
load c.txt;
P=pdist(c,'euclidean');
Z=linkage(P,'single');
T=cluster(Z,'MaxClust',2);
plot_clusters(c,T);
I tried it with my data , it is working except the last function , it is what I looked for , this function plot each cluster with different color
how can find it? please, i badly need it in my work.
thanks

7 commentaires

Oleg Komarov
Oleg Komarov le 28 Août 2012
@huda: I posted a link because there's a much easier facility to format the code.
After 130 and more question you still don't take the effort to watch (you don't even have to read) the .gif or to read some simple guidelines.
Jan
Jan le 28 Août 2012
Modifié(e) : Jan le 28 Août 2012
I second Oleg's impression. Please, huda, show some respect and care about the conventions in the forum. I you do not care about making the questions as easy to understand as possible, the forum will loose the interest in your questions also.
huda nawaf
huda nawaf le 28 Août 2012
But my question is very clear, this is why Oleg reply to me . I'm agree with you just about format my code at first, later I formatted it.
nevertheless, I present my apology
Oleg Komarov
Oleg Komarov le 28 Août 2012
Modifié(e) : Oleg Komarov le 28 Août 2012
@huda: I had a teacher of biology in high school who used to say "I cannot spread apologies on my bread (in the morning when having breakfast)".
In brief, this is not the first time I post the link on how to format the question or the other link on how to ask a question properly. Also, it is common sense to provide the necessary information if you expect a reasonable answer. Thus, saying "I am sorry" and still keeping to post the same way is equivalent to fool us around. Obviously, that's my point of view.
Walter Roberson
Walter Roberson le 28 Août 2012
huda, you have not formatted the code in this post.
Jan
Jan le 29 Août 2012
@huda: Thanks for your apology. Apologies are not useful here, but improving your style to ask question is. Most of all this would be an advantage for me, the forum and last but not least for yourself.

Connectez-vous pour commenter.

Réponses (2)

huda nawaf
huda nawaf le 28 Août 2012
Modifié(e) : huda nawaf le 28 Août 2012

0 votes

Many thanks,
I got it and run it. But what if I ran the above code on my data but my data is not 2D , my data is n*n similarity matrix, and I ran the above function on my data
P=pdist(c,'euclidean');
Z=linkage(P,'single');
T=cluster(Z,'MaxClust',2);
and got T the label for each observations (n). Now , i want to use plot_clusters with this case . if plot_clusters is not working with this case, are there alternative way to see the clusters graphically.
thanks

10 commentaires

Oleg Komarov
Oleg Komarov le 28 Août 2012
One question per post and how am I supposed to know since you don't provide a test suite.
The general answer is, yes you can write alternative ways to see clusters graphically, example gscatter().
Walter Roberson
Walter Roberson le 28 Août 2012
Alternate plotting methods were suggested to you at least a week ago, in one of the several other threads where you asked the same question.
huda nawaf
huda nawaf le 29 Août 2012
Olg, Gscatter creates a scatter plot of the vectors X and Y grouped by G. But I have similarity matrix with size n*n , and vector with size n show the cluster no. that each observation in similarity matrix belong to it.
This is what I have , are there function can deal with these input? thanks
huda nawaf
huda nawaf le 29 Août 2012
walter, but my problem is still opened. all suggestions were relate functions deal with two or three vectors, whereas I have n*n matrix
thanks
Walter Roberson
Walter Roberson le 29 Août 2012
Huda, I refuse to keep trying to read your mind about what you want the output to look like!
Oleg Komarov
Oleg Komarov le 29 Août 2012
Modifié(e) : Oleg Komarov le 29 Août 2012
@huda: what if I told you that you can still use gscatter()?
(You have to read the sentence having the meme in mind)
I second Walter and I will repeat myself for the n-th time, read these guidelines http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer, after that you will understand that
  1. One and only one question per post
  2. No duplicate posts
  3. If you can't get an answer, 99.9% of the times your question is wrong.
  4. Post example inputs and example output
  5. Use markup to format your question (especially the code)
"Olg, Gscatter creates a scatter plot of the vectors X and Y grouped by G. But I have similarity matrix with size n*n , and vector with size n show the cluster no. that each observation in similarity matrix belong to it."
So? I don't see the problem. The vector relates to each row instead of each element, repmat it, make the n by n matrix a vector and use gscatter().
huda nawaf
huda nawaf le 30 Août 2012
Modifié(e) : Oleg Komarov le 30 Août 2012
Thanks for your patience, but I really face problem. by the way I read how to format your question,in future I will flow all instructions there. I think now, I have not code , not link. Just need give u example. Let me give u example:
*similarity matrix=[1 0.4 0.5 0;
0.4 1 0.6 0.3;
0.5 0.6 1 0.7;
0 0.3 0.7 1];*
the following vector show the cluster no. for each row in similarity matrix:
*T=[ 1 1 2 3 ];*
Now, please told me how use Gscatter with these inputs.
thanks
Walter Roberson
Walter Roberson le 30 Août 2012
What do you want the output to look like?
Oleg Komarov
Oleg Komarov le 30 Août 2012
As commented in your other post, with the similiarity matrix alone, all you can do is a dendrogram.
huda nawaf
huda nawaf le 30 Août 2012
Modifié(e) : Walter Roberson le 30 Août 2012
Walter,
just need each cluster with differnt color and contain the number of objects inside it.
I sent image in that post. thanks

Connectez-vous pour commenter.

Catégories

En savoir plus sur Graphics Performance dans Centre d'aide et File Exchange

Question posée :

le 28 Août 2012

Community Treasure Hunt

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

Start Hunting!

Translated by