Info

此问题已关闭。 请重新打开它进行编辑或回答。

Subscript indices must either be real positive integers or logicals.

1 次查看(过去 30 天)
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