function I = readasf(fname)
fid=fopen(fname);
txt=fscanf(fid,'%c');
fclose(fid);

km=strfind(txt,'length');
LF=str2num(txt(km(1)+7:km(1)+13));
NL=2.54/(LF*100);
for j=2:31
    lens(j-1)=str2num(txt(km(j)+7:km(j)+13));
end
L_upperbody = sum(lens(11:16))*NL;
R_upperbody = 0.15;
M_upperbody = 41;

L_thigh = lens(7)*NL;
R_thigh = 0.07;
M_thigh = 5.5;

L_shin = lens(8)*NL;
R_shin = 0.05;
M_shin = 3.5;

L_foot = (lens(9)+lens(10))*NL;
B_foot = 0.08;
M_foot = 1;

I(:,:,1) = diag([ M_upperbody*R_upperbody^2/4 + M_upperbody*L_upperbody^2/12 , ...
    M_upperbody*R_upperbody^2/4 + M_upperbody*L_upperbody^2/12, 0.5*M_upperbody*R_upperbody^2]);

I(:,:,2) = diag([ M_thigh*R_thigh^2/4 + M_thigh*L_thigh^2/12 , ...
    M_thigh*R_thigh^2/4 + M_thigh*L_thigh^2/12, 0.5*M_thigh*R_thigh^2]);
I(:,:,3) = I(:,:,2);
I(:,:,4) = diag([ M_shin*R_shin^2/4 + M_shin*L_shin^2/12 , ...
    M_shin*R_shin^2/4 + M_shin*L_shin^2/12, 0.5*M_shin*R_shin^2]);
I(:,:,5) = I(:,:,4);
I(:,:,6) = diag([ 7*M_foot*B_foot^2/12, 7*M_foot*L_foot^2/12 , M_foot*(L_foot^2+B_foot^2)/12]);
I(:,:,7) = I(:,:,6);
return;