function  BVH2CSV( bvhfilename )

% [skel1, chh, fl ] = bvhReadFile(bvhfilename);
% for i=1:size(chh,1)
% [skel2,echh(i,:)] = bvh2expmap(skel1,chh(i,:));
% end

[skel, channels, fl ] = bvhReadFile(bvhfilename);

xyz_dims = size(skel.tree,2)*3;
channelsxyz = zeros (size(channels,1), xyz_dims);
for i=1:size(channels,1)
    a = bvh2xyz(skel, channels(i,:));
    channelsxyz(i,:) = reshape (a', 1, xyz_dims);
end
       
csvwrite(strcat(strrep(bvhfilename,'.bvh','_2.csv')),channelsxyz);
    

end

