[coeffA,scoreA,latentA] = pca(X);

4 views (last 30 days)
Carol
Carol on 16 Sep 2025
Edited: John D'Errico on 18 Sep 2025
The editor is complaining that the matrix of values, scoreA, is unused.

Accepted Answer

Steven Lord
Steven Lord on 16 Sep 2025
If you truly do not need the second output (but do need the first and third) tell MATLAB to ignore the second output when you call pca.

More Answers (1)

John D'Errico
John D'Errico on 18 Sep 2025
Edited: John D'Errico on 18 Sep 2025
The editor likes to complain. Just the kind of program it is.
Think about this as a suggestion, a hint, in case maybe your code has an error in it. This might help you to locate the bug, IF there is one. If not, then feel free to ignore the complaint. A complaint like this is not an error message, just a complaint from that whiny, pesky editor.
If it still bothers you for whatever reason, then do this:
[coeffA,~,latentA] = pca(X);
That tells MATLAB to not store the second return argument from PCA. That second argument now goes directly into bit bucket limbo, never to be seen again. But now the complaint will go away, and the editor will be happy again, free to find something else it dislikes about your code. What can I say? You will never make it truly happy.

Categories

Find more on Dimensionality Reduction and Feature Extraction in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!