www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/CompareVectorElementsExample.m

    %% Compare Vector Elements
% Compare the elements in a column vector and a row vector. The result is a
% matrix containing the comparison of each combination of elements from the
% vectors. An equivalent way to execute this operation is with |A > B|.
A = [8; 17; 20; 24]

%%
B = [0 10 21]

%%
C = bsxfun(@gt,A,B)