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

    %% Specify Dimension for Variance
% Create a matrix and compute its variance along the first dimension.  

% Copyright 2015 The MathWorks, Inc.

A = [4 -2 1; 9 5 7];
var(A,0,1)

%%
% Compute the variance of |A| along the second dimension.
var(A,0,2)