- Variable i1 is a not square(*), or
- size(H',2) ~= size(Data.y,1)(*), or
- didn't intend to use matrix multiplication but element-wise which is the "dot" operator ".*"
error in the code not getting removed
1 次查看(过去 30 天)
显示 更早的评论
Hello Experts, I have code in which it gives error of "Error of inner matrix dimension". i have checked many of answers in the group asked by others and tried but it is not getting removed. Help me to remove this error.If i comment that line of code it runs.Error is not in "main.m" program but it is in "trainRELM.m" line no 87. While i run the main.m it gives error Error using * Inner matrix dimensions must agree.
Error in trainRELM (line 87)
w = (H'*H+l1*eye(nh,nh))\(H'*Data.y);
is main cause of error
Error in Main (line 47)
LR2 = trainRELM(DataTG,Params);
I have attached the code and dataset.
0 个评论
采纳的回答
dpb
2017-4-14
You have two matrix multiplications in the offending line H+l1*eye(nh,nh))\(H'*Data.y);
So, the problem is one of the following:
Don't know which of the above is the actual case nor necessarily the answer you need as didn't try to read the code but looking through your algorithm for the intended result ensuring that you can actually perform a legal matrix multiplication if that's what is wanted or if it is computation in the numerator/denominator of the expression that is supposed to be element-by-element, then fix the operator to do that instead.
() Matrix multiplication requires A*B have dimensions such that are [m x n][n x q] with result of [m x q].
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!