function writehtk(name,MAT)
% writehtk(name,MAT)
%
% Simple function to write an HTK file. HTK deafult (BIG endian) is used. 
% accepts only FLOAT vectors 

[P,nSamples]=size(MAT);

sampSize = P*4;
sampPeriod = 100000;
paramKind = 9; % USER

ff = fopen (name,'w','b');
% write header
fwrite (ff,nSamples,'int');
fwrite (ff,sampPeriod,'int');
fwrite (ff,sampSize,'short');
fwrite (ff,paramKind,'short');
% determine amount of data to read and read 
fwrite (ff, MAT , 'float');
%fwrite (ff,XX,'short');
fclose (ff);
