Biplot label error after following matlab help guide
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
desert_scientist90
le 4 Fév 2020
Réponse apportée : Sahithi Kanumarlapudi
le 7 Fév 2020
Hi I am trying to display the results of my PCA analysis on a biplot by following the example on https://www.mathworks.com/help/stats/biplot.html . I want to add the labels to the lines and scores. After I created hid to label my houses on the graph I get the following error message:
VarLabels' value must be a string array, a character array, or a cell array of character vectors with one ↑
Error: Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or
other syntax error. To construct matrices, use brackets instead of parentheses.
>>
Is there source that I can refer to to fix this issue and also add the labels on the scores display as dots? Thanks in advance for your help
biplot(coefs(:,1:2)),'Score',score(:,1:2); %% graph step
hid = {'House1','House2','House3','House4','House5','House6','House7','House8' 'House9'}; % Array of variable labels for lines on the graphs
h = biplot(coefs(:,1:2),'Scores',score(:,1:2),...
'Color', 'b', 'Marker', 'o', 'VarLabels', hid);
0 commentaires
Réponse acceptée
Sahithi Kanumarlapudi
le 7 Fév 2020
Hi,
‘VarLabels’ must be a vector with one label for each row of the coefficients matrix. Error will be raised if the number of labels is greater or less than the rows in the coefficient matrix. Make sure of this. Error might note be because of the data in cell array.
And in your command, you have to use ‘Scores’ instead of ‘Score’.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Dimensionality Reduction and Feature Extraction dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!