function [goods,goodl,cntg,bads,badl,cntb,keywrd]=load_tapes(base_name,ext) % function [goods,goodl,cntg,bads,badl,cntb,keywrd]=load_tapes(base_name,ext) % % goods and bads are cell arrays of matrices of scores. % goodl and badl are cell arrays of matrices of lengths. % cntg and cntb are numbers. % keywrd is the name. % % base_name will be completed by good/bad % see /home/cernocky/SPOTTING/STOOLKIT_HONZA/README_HONZA gname = [base_name '_good.' ext]; bname = [base_name '_bad.' ext]; fg = fopen(gname,'r'); fb = fopen(bname,'r'); % read the keywrd name keywrd = fscanf(fg,'%s',[1 1]); keywrd = fscanf(fb,'%s',[1 1]); % read goods: cntg = 0; while (cntg < inf) [len,cnt] = fscanf(fg,'%d',[1 1]); if cnt ~= 1 break end cntg = cntg +1; % will be used for Matlab indexing ! scores = fscanf (fg,'%f',[1 len]); goods{cntg} = scores; lengths = fscanf (fg,'%d',[1 len]); goodl{cntg} = lengths; end % read and plot bads: cntb = 0; while (cntb < inf) % for debug to stop it ... put 10 or 20 or so to see less [len,cnt] = fscanf(fb,'%d',[1 1]); if cnt ~= 1 break end cntb = cntb + 1; % will be used for Matlab indexing ! scores = fscanf (fb,'%f',[1 len]); bads{cntb} = scores; lengths = fscanf (fb,'%d',[1 len]); badl{cntb} = lengths; end disp ([keywrd ' ' num2str(cntg) ' ' num2str(cntb)]); fclose (fg); fclose (fb);