Functions with many inputs and outputs
% bit of a jump but important to realise that
% functions can have many inputs and outputs
%
function [minvec, maxvec, meanvec] = arrayview(varargin)
% nargin tells us how many inputs there are
howmany = nargin;
% make space for the outputs
minvec = zeros(howmany,1);
maxvec = zeros(howmany,1);
meanvec = zeros(howmany,1);
% go round the right number of times
for ii = 1:howmany
array = cell2mat(varargin(ii));
minvec(ii) = min(array(:));
maxvec(ii) = max(array(:));
meanvec(ii) = mean(array(:));
end
end