矩阵尺寸必须一致吗?
问题描述:
您好我不断收到错误:矩阵尺寸必须一致吗?
>> maxM = max(M);
>> minM = min(M);
>> Mnormalize = ((M-minM)./(maxM-minM) - 0.5) *2;
??? Error using ==> minus
Matrix dimensions must agree.
M档看起来像这样
答
出现这种情况是M
是一个二维矩阵。
如果是这种情况,那么maxM
和minM
竟然会被行M
,而且由于失败的事实,你不能把例如[1 2; 3 4] - [1 2]
。
如果你想的最小/最大整个矩阵,你可能想要做
maxM = max(M(:))
minM = min(M(:))
...和PengOne说,/
(而不是./
)应该在这种情况下做的很好。
相关问题:
+0
任何解决方案? –
+1
是的。答案已更新。 – aioobe
什么M'的'尺寸是多少? – aioobe
更新忘了添加图像尺寸是49K 42 42 –