function cnt = writefeat(filename, indata)
%by Kshitiz Kumar
%
%this script writes with machineformat = 'ieee-be'

fid = fopen(filename, 'wb', 'ieee-be');
if(fid == -1)
    disp(filename);
    disp('Could not open file');
    cnt = -1;
else
    % Write the header part  -- To be compatible with the SPHINX format
    cnt = fwrite(fid, numel(indata),'int32',0);
%   cnt = fwrite(fid, prod(size(indata)),'float32',0);  
    if(cnt ==1)
        indata = indata(:);
        cnt = cnt + fwrite(fid, indata, 'float32',0);
    end
end
if(cnt ~= numel(indata) +1)
    disp(filename);
    error('Write failed');

end
fclose(fid);
