フィルターのクリア

Biplot label error after following matlab help guide

4 ビュー (過去 30 日間)
desert_scientist90
desert_scientist90 2020 年 2 月 4 日
回答済み: Sahithi Kanumarlapudi 2020 年 2 月 7 日
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);

採用された回答

Sahithi Kanumarlapudi
Sahithi Kanumarlapudi 2020 年 2 月 7 日
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 件)

カテゴリ

Help Center および File ExchangeDimensionality Reduction and Feature Extraction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by