Matrix contains incorrect values if disp(matrix), but if disp(matrix (2,1)) it returns a correct value
Show older comments
Hello everyone, I am a beginner with matlab and I would really appreaciate if somone would give me a bit of help, since i have quite poor knowledge of matlab. I have a vector of returns that has length of 4475. I want to create a moving window of 250 observations, so that for each pack of 250 observations I could use a function mle(data,'distribution','tLocationScale); to estimate distribution. But what is crucial for me is to extract vector of degrees of freedom. My code looks like this:
N = length(returns_sp500);
l = 250;
for t = 1:(N-1+1)
if t<=4226
estPara_sp500(t,:)=mle(returns_sp500(t:(t+l-1)), ...
'distribution','tlocationscale');
else
break
end
end
But when I try to diplay it it shows me a matrix with mostly zeros. However, if I display a particular element of matrix it looks perfectly fine.
column1 = estPara_sp500(:, 3);
disp(column1) % zeros
disp(column1(1)) % returns a correct value
If someone has a clue where is my error and how can I fix it, please help :)
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!