%% Determine Size of Variables
% Determine the size of a variable, and then calculate the average of each column.
% Open the example MAT-file, stocks.mat.

filename = 'stocks.mat';
m = matfile(filename);

%
% Determine the size of the variable, stocks, in stocks.mat.

[nrows,ncols] = size(m,'stocks');

%
% Compute the average of each column of the variable stocks.

avgs = zeros(1,ncols);
for i = 1:ncols
    avgs(i) = mean(m.stocks(:,i));
end

% Copyright 2012 The MathWorks, Inc.