Info

This question is closed. Reopen it to edit or answer.

Subscript indices must either be real positive integers or logicals.

2 views (last 30 days)
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 Comment
Stephen23
Stephen23 on 4 Nov 2015
Edited: Stephen23 on 4 Nov 2015
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.

Answers (1)

Walter Roberson
Walter Roberson on 4 Nov 2015
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.

Tags

Community Treasure Hunt

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

Start Hunting!