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

    %% Locate Nonzero Values
% Find the logical AND of two matrices. The result contains logical |1|
% (|true|) only where both matrices contain nonzero values.
A = [5 7 0; 0 2 9; 5 0 0]

%%
B = [6 6 0; 1 3 5; -1 0 0]

%% 
A & B