【发布时间】:2013-07-10 18:54:11
【问题描述】:
这段代码在 Octave 中完美运行,但在 Matlab 中却不行。但为什么?有什么解决方法吗?谢谢。
a = [0; 5; 10];
b = [3 5 7];
a >= b
八度音阶行为:
0 0 0
1 1 0
1 1 1
Matlab 行为:
Error using >
Matrix dimensions must agree.
【问题讨论】:
-
这是因为 Octave 是自动广播的,在 Matlab 中你必须自己做。最有效的方法通常是
bsxfun。