%   FUNCTION
%   Objective:
%       Demonstrate the usage of a function and its specification.
%
%   Remarks: The function is used when a set of codes are repeadly used. This set of code
%				can then be grouped and forms a m-file to execute a certain job.


function function_sample(filename)
y=load(filename);
%Another way of loading data
%load weight.txt;
data=y(:,2);
[weight_mean, weight_var]=mean_var(data);
fprintf('The mean is %f   and the variance is %f  ',weight_mean,weight_var);



function [sample_mean, sample_var]=mean_var(x)

sample_mean=mean(x);
sample_var=var(x);

%End of function
