Biplot label error after following matlab help guide

4 visualizzazioni (ultimi 30 giorni)
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);

Risposta accettata

Sahithi Kanumarlapudi
Sahithi Kanumarlapudi il 7 Feb 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’.

Più risposte (0)

Categorie

Scopri di più su Dimensionality Reduction and Feature Extraction in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by