Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Getting error: Attempted to access latent(12); index out of bounds because numel(latent)=11.

1 ビュー (過去 30 日間)
saleem pasha
saleem pasha 2014 年 9 月 26 日
終了済み: MATLAB Answer Bot 2021 年 8 月 20 日
i have a main function as testing.m From testing.m iam calling the function features=featuresss(bw4); //bw4 is binary image
in featuresss.m, i have written C = fdct_wrapping(image, 1, 1, ceil(log2(min(256,256)) - 3), 16); %x = ifdct_wrapping(C,1,256, 256); x = fdct_wrapping_dispcoef(C); [COEFF,SCORE,latent] = princomp(x); sumnew=0; for i=1:22 sumnew=sumnew+(latent(i)); end features(1,26)=sumnew; //here 26 refers to 26th feature
Getting an error as In testing at 22 ??? Attempted to access latent(12); index out of bounds because numel(latent)=11.
Error in ==> featuresss at 218 sumnew=sumnew+(latent(i));
Error in ==> testing at 22 features=featuresss(bw4);
kindly, solve this error.
Thank you

回答 (1 件)

Julia
Julia 2014 年 9 月 26 日
Hi,
The array latent has only the length 11 and you try to access the 12th entry.
for i=1:length(latent)
should solve this issue.

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by