MATLAB: Matrix dimensions must agree. MATLAB hi, I am getting this error in my code. can anybody help me with this. Thank you in advance. Best Answer On that line instead of the right-matrix division operator (which does matrix division): /you need to use the right array division operator (which works element-wise):./And read this to know the difference:http://www.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.htmlbecause you will fix that line and get exactly the same error on the following lines. When you understand the difference between matrix and array operations then you can solve this yourself. Related SolutionsMATLAB: Does this showing inf Look at the value of 1\n .Are you certain that you intended to use Matrix Left Divide rather than ./ ? MATLAB: Reshape problem in matlab This code works for me just fine:h = zeros(65536,1)h = reshape(h, 256, 256);Are you 100% sure you are not doing something in between those two lines that changes the shape of h? I suggest you insert the lineN = numel(h)just before you do the resize, just to be sure. Related Question
Best Answer