1
votes

I am unsure why I get the error. Can anyone help please

L = [];
indexgood=1;
load mrsgarch_t2
eval(['L(:,',num2str(indexgood),') = Loglike(:);']);
indexgood=indexgood+1;  

The error I get:

Subscripted assignment dimension mismatch

thanks

2
What is the code trying to do? Why do you need to use eval? - Oliver Charlesworth
What is Loglike? Why are you using eval? - Dan
thanks for replying i tried to creat variables for each loops. - user2451341

2 Answers

1
votes

Appernetly, the size (and dimensionality) of L(:,indexgood) is different than the size of Loglike(:).

Is it possible that there is a saved variable L in the file mrsgarch_t2.mat?

You will get this error if the number of rows in L is different than the number of elements in Loglike.

1
votes

From the code and other comments/answers, my guess is either that L is still empty, which could return that error when you try and access L(:,1), or that logLike(:) is not returning nice 1-d values.

Do us a favor and do: disp(L);pause before you evaluate it and see if its what you were expecting. If you could give us the class and dimensions of logLike and L once its loaded, that would be great.

Additionally, if you are loading L every time, setting L to [] is redundant and can be removed.