[英]Subscripted assignment dimension mismatch MATLAB
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 谢谢
Appernetly, the size (and dimensionality) of L(:,indexgood)
is different than the size of Loglike(:)
. 适当地, L(:,indexgood)
的大小(和维数)不同于Loglike(:)
的大小。
Is it possible that there is a saved variable L
in the file mrsgarch_t2.mat
? 文件mrsgarch_t2.mat
是否可能存在一个已保存的变量L
?
You will get this error if the number of rows in L
is different than the number of elements in Loglike
. 如果L
的行数与Loglike
的元素数不同,则会出现此错误。
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. 从代码和其他注释/答案中,我的猜测是L仍然为空,当您尝试访问L(:,1)时可能返回该错误,或者logLike(:)没有返回良好的一维值。 。
Do us a favor and do: disp(L);pause before you evaluate it and see if its what you were expecting. 帮我们一个忙,然后做:disp(L);在评估它之前先暂停一下,看看它是否符合您的期望。 If you could give us the class and dimensions of logLike and L once its loaded, that would be great. 如果您可以给我们logLike和L加载后的类和尺寸,那就太好了。
Additionally, if you are loading L every time, setting L to [] is redundant and can be removed. 另外,如果每次都加载L,则将L设置为[]是多余的,可以删除。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.