gscatter grouping variable
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all,
I need some help with the input parameters of gscatter. I am a beginner so please overlook if my questions are silly.
I am trying to do a supervised classification of Inertial data. My user selects two points (start and end) from a plot, where all the training classes are shown together either the accleration or gyro etc. I save this region and call classify() on this sample. The function gives me a vector denoting to which group of my training this sample belongs. Now I wish to plot this information.
I am using gscatter(T,C,group). T is 1 to the row count of C. C is the result of the classify() i.e it is of the size of the sample prevously chosen and group is vector where the training groups are indicated. For example rows 1-130 has value 1, 131-162 has value 2 and so on. Row count of group is same as that of all training classes summed together.
I get an error, *??? Error using ==> gscatter at 84 There must be one value of G for each row of X. *
Please help.
Avishek
3 commentaires
Oleg Komarov
le 5 Juin 2012
It would be simpler if you posted a code snippet that reproduced the error.
Réponse acceptée
Tom Lane
le 5 Juin 2012
The idea is that the jth point on the plot is x=T(j) vs y=C(j) with the symbol chosen according to the group value group(j). They should all have the same number of points. If you are subsetting your data to get T and C (I can't tell from your description if that is the case), perhaps you need to subset the group variable the same way.
0 commentaires
Plus de réponses (1)
Avishek Dutta
le 5 Juin 2012
1 commentaire
Tom Lane
le 5 Juin 2012
If training and group have the same size, and you take the pointx1:pointx2 subset of training to get sample, and you compute C for sample, then I would think you want to supply group(pointx1:pointx2) when you run gscatter.
Voir également
Catégories
En savoir plus sur Discriminant Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!