Why this message error?
1 回表示 (過去 30 日間)
古いコメントを表示
n=size(prices,2);
M_coint=zeros(n,n);
for i=1:n;
j=1:n;
M_coint(i,j)=cadf(prices(:,i),prices(:,j),0,1);
M_coint(i,j)=M_coint.adf;
end
message error: The following error occurred converting from struct to double: Error using double Conversion to double from struct is not possible.
採用された回答
Stephen23
2015 年 9 月 22 日
編集済み: Stephen23
2015 年 9 月 22 日
cadf does not seem to be an inbuilt MATLAB function, and you give no information about how it is defined or the output that it returns. And you also don't give us the complete error message (which tell us the line), so we have to also guess where this error is occurring in your code.
I like guessing games, so lets try.
First you define
M_coint=zeros(n,n);
which means M_coint is a matrix of class double. Then if we assume that cadf returns a structure, then the line
M_coint(i,j)=cadf(...)
will try to allocate that structure to M_coint.
Ouch! Allocating a structure to a double is an error! It does not work.
4 件のコメント
Stephen23
2015 年 9 月 23 日
This is a different topic to your original question. Please search for solutions to this new topic in the documentation, on the internet, or in this forum.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Function Creation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!