error 'Index exceeds matrix dimensions.'

7 ビュー (過去 30 日間)
sisay
sisay 2012 年 10 月 23 日
I want to compute the following code but an error which says 'Index exceeds matrix dimensions' appears and I find it puzzling. More to this the 'jj' which suppose to 25 become '1' and 'tcal' changes from 26 to 25.. Here is the code
for ii = 1:length(datafiles);
%%files will be loaded here%%
tcal = max(min(time),min(hTime)):dt:min(max(time),max(hTime));
Sca1 = interp1(time,ssc,tcal);
x= cast(calpre, 'double');
kk=1:1:length(x);
B=repmat(reshape(x(kk),1,1,length(x)),20,40);
M=M(:,:,3);
M1 = permute(M*1000,[2 1]);
M2= interp1(hTime,M1,tcal);
for jj = 1:length(tcal);
h2(:,:,jj)=h(:,:,jj)-B(:,:,jj).*0.001;
sig2(:,:,jj)=sig1(:,:,jj).*(h2(:,:,jj)./h(:,:,jj));
C(:,:,jj) = max(sig2(:,:,jj),[],1
Sca1l = permute(Sca1 ,[3 2 1]);
Sca13(:,:,jj)=interp1(sig1(:,1,jj),Sca1l(:,:,jj),C(:,jj)');
end
end
Any help is highly appreciated

採用された回答

Matt J
Matt J 2012 年 10 月 23 日
The DBSTOP command is good for finding errors like these.
  1 件のコメント
sisay
sisay 2012 年 10 月 23 日
Thanks I will try this

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

その他の回答 (1 件)

Matt J
Matt J 2012 年 10 月 23 日
'Index exceeds matrix dimensions.' is nothing too mysterious. It happens when you do things like this:
>> x=1:5
x =
1 2 3 4 5
>> x(6)
Index exceeds matrix dimensions.

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by