Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Subscript indices must either be real positive integers or logicals.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Stephen23
el 4 de Nov. de 2015
Editada: Stephen23
el 4 de Nov. de 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.
Respuestas (1)
Walter Roberson
el 4 de Nov. de 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.
0 comentarios
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!