Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这段代码在 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.
使用bsxfun:
bsxfun
>> bsxfun( @ge, a, b ) ans = 0 0 0 1 1 0 1 1 1
bsxfun太有趣了!