- 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 view (last 30 days)
Show older comments
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 Comments
Accepted Answer
dpb
on 14 Apr 2017
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].
7 Comments
More Answers (0)
See Also
Categories
Find more on Matrix Indexing 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!