Error using fread Invalid file identifier. Use fopen to generate a valid file identifier. Error in htkread (line 8) nframes = fread(fid, 1, 'int32'); % number of frames
Error in DebugCode (line 13) data{ix} = htkread(filenames{ix});
The code of functions where the errors arise are:
function gmm = mapAdapt(dataList, ubmFilename, tau, config, gmmFilename).......if ischar(dataList) || iscellstr(dataList), dataList = load_data(dataList);endif ~iscell(dataList), error('Oops! dataList should be a cell array!');endnfiles = length(dataList);..........end
*****************************************************************************
function data = load_data(datalist)% load all data into memory
if ~iscellstr(datalist) fid = fopen(datalist, 'rt'); filenames = textscan(fid, '%s'); fclose(fid); filenames = filenames{1};else filenames = datalist;endnfiles = size(filenames, 1);data = cell(nfiles, 1);for ix = 1 : nfiles, data{ix} = htkread(filenames{ix});end
**************************************************************************************
function [data, frate, feakind] = htkread(filename) % reads features with HTK format
%
% Omid Sadjadi <s.omid.sadjadi@gmail.com>
% Microsoft Research, Conversational Systems Research Center
fid = fopen(filename, 'rb', 'ieee-be'); nframes = fread(fid, 1, 'int32'); % number of frames %%ERROR
frate = fread(fid, 1, 'int32'); % frame rate in 100 nano-seconds unit
nbytes = fread(fid, 1, 'short'); % number of bytes per feature value
feakind = fread(fid, 1, 'short'); % 9 is USER
ndim = nbytes / 4; % feature dimension (4 bytes per value)
data = fread(fid, [ndim, nframes], 'float'); fclose(fid);
datalist.txt is a file with 6300 entries like
htkfiles\fadg0_si1279.htkhtkfiles\fadg0_si1909.htkhtkfiles\fadg0_si649.htkhtkfiles\fadg0_sx109.htkhtkfiles\fadg0_sx19.htkhtkfiles\fadg0_sx199.htkhtkfiles\fadg0_sx289.htkhtkfiles\fadg0_sx379.htkhtkfiles\faem0_sa1.htkhtkfiles\faem0_sa2.htkhtkfiles\faem0_si1392.htkhtkfiles\faem0_si2022.htkhtkfiles\faem0_si762.htkhtkfiles\faem0_sx132.htkhtkfiles\faem0_sx222.htkhtkfiles\faem0_sx312.htkhtkfiles\faem0_sx402.htkhtkfiles\faem0_sx42.htkhtkfiles\fajw0_sa1.htkhtkfiles\fajw0_sa2.htkhtkfiles\fajw0_si1263.htkhtkfiles\fajw0_si1893.htk
Best Answer