フィルターのクリア

Index exceeds matrix dimensions

1 回表示 (過去 30 日間)
Amine Ben Ayara
Amine Ben Ayara 2015 年 9 月 1 日
編集済み: James Tursa 2015 年 9 月 1 日
I keep getting an error every TIME i RAN THIS LOOP: %loop
M(:,:,:,1)=M1;
M(:,:,:,2)=M2;
M(:,:,:,3)=M3;
YC(:,:,1)=YC1;
YC(:,:,2)=YC2;
YC(:,:,3)=YCC3;
[M1]=ProbabiltyCounty1( X,Lam ,YC1)
[M2]=ProbabiltyCounty1( X,Lam ,YC2)
[M3]=ProbabiltyCounty1( X,Lam ,YCC3)
for i= 1:3;
for j=1:3;
YC= YC(:,:,i);
MatrixM= M(:,:,:,j);
end
end
FinalOutput= [MatrixM]
AYesIdiditNow2=[FinalOutput];
Index exceeds matrix dimensions.

採用された回答

James Tursa
James Tursa 2015 年 9 月 1 日
編集済み: James Tursa 2015 年 9 月 1 日
This line:
YC= YC(:,:,i);
replaces the original multi-page YC with only one page of YC the first time through the loop. So the next time through the loop when i>1 the YC(:,:,i) is referencing pages that are no longer there.
  2 件のコメント
Amine Ben Ayara
Amine Ben Ayara 2015 年 9 月 1 日
Hey James, Thanks for your answer. I am failry new to Matlab and my struggles are real! What do you mean by multi-page? Thanks
James Tursa
James Tursa 2015 年 9 月 1 日
編集済み: James Tursa 2015 年 9 月 1 日
In "array terminology", a 2-dimensional (2D) array is referred to as a "matrix". An array having more than two dimensions is often referred to as a multi-dimensional array, or nD array. In this latter case, the first two dimensions of such an array are often referred to as the "pages" of the array (i.e., the nD array is made up of multiple 2D "pages"). E.g., a 3x2x5 dimensional array can be thought of as 5 pages of 3x2 matrices.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by