Info

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

Subscript indices must either be real positive integers or logicals.

1 回表示 (過去 30 日間)
fede
fede 2015 年 11 月 4 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have this code
n=size(tickers,2);
tempo=90;
d=size(prices,1);
f=d-tempo;
meancoint=zeros(f,1);
M_coint=zeros(n,n);
for s=tempo+1:size(prices,1);
for i=1:n;
for j=1:n;
if i==j;
M_coint(i,j)=0;
else
tmp=cadf(prices(s-tempo:s,i),prices((s-tempo:s),j,0,1));
M_coint(i,j)=tmp.adf;
meancoint(s)=sum(M_coint(:))/(n(n-1));
end
end
end
end
gives me this error: Subscript indices must either be real positive integers or logicals.
  1 件のコメント
Stephen23
Stephen23 2015 年 11 月 4 日
編集済み: Stephen23 2015 年 11 月 4 日
Can you please give us the complete error message, not just the bits that you find interesting. The complete error message include other useful information, such as detail of the operations and line where the error occurs. The complete error message is all of the red text.
You can edit your question to give this info.

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 11 月 4 日
Look more closely at
tmp=cadf(prices(s-tempo:s,i),prices((s-tempo:s),j,0,1));
This is cadf() with first argument
prices(s-tempo:s,i)
and second argument
prices((s-tempo:s),j,0,1)
The first of those suggests that prices is intended to be a 2D array. The second of those suggests that prices is a 4D array and that you want the index of the third dimension to be 0.

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by