Can't use pca() function - Error using statset No default options available for the function 'pca'.

조회 수: 7 (최근 30일)
I'm trying to use the pca() function from the stats toolbox and I'm getting an error from within the pca function itself:
defaults = {'svd', true, true, p, 'complete',...
ones(1,n,'like',x) ,ones(1,p,'like',x), [], [], statset('pca')};
Error using statset
No default options available for the function 'pca'.
I'm not sure what the issue could be but MATLAB also says in the documentation for pca():
Options for the iterations, specified as a comma-separated pair consisting of 'Options' and a structure created by the statset function.
I tried investigating the problem but I can't find any other recorded instances of this error.

답변 (2개)

Supraja
Supraja 2023년 6월 2일
Your code is working fine when I tried to run at my end given that your values for p, x and n are correct.
Please find the documentation link for “pca” function here: https://www.mathworks.com/help/stats/pca.html?searchHighlight=pca%20function&s_tid=srchtitle_pca%20function_1#d124e743715

Steven Lord
Steven Lord 2023년 6월 2일
Let's make sure you're using the pca and statset functions included with Statistics and Machine Learning Toolbox rather than other functions by those names in third-party products. What do these commands show on your machine?
which -all pca
/MATLAB/toolbox/stats/stats/pca.m /MATLAB/toolbox/stats/bigdata/@tall/pca.m % tall method /MATLAB/toolbox/stats/gpu/@gpuArray/pca.m % gpuArray method
which -all statset
/MATLAB/toolbox/stats/stats/statset.m

카테고리

Help CenterFile Exchange에서 Dimensionality 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