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

    %% Subtract Two Arrays  

%% 
% Create two arrays, |A| and |B|, and subtract the second, |B|, from the
% first, |A|. 
A = [1 0; 2 4];
B = [5 9; 2 1];
C = A - B 

%%
% The elements of |B| are subtracted from the corresponding elements of
% |A|.

%% 
% Use the syntax |-C| to negate the elements of |C|. 
-C