Biplot label error after following matlab help guide

4 visualizaciones (últimos 30 días)
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);

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Dimensionality Reduction and Feature Extraction en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by