Getting Error: Cell contents reference from a non-cell array object. Error in recording (line 64) M = menu({'Isolated Word Speech Recognition',' '...

1 view (last 30 days)
function recording % records vocabulary sets as sample#.mat (#=1,9) % cd('E:\speech'); global Names Words Feat Cls Fs Fn Tn Tries Thres Test V First Alg St K Voc v = 3; % Version 3-14-01 V(3) = v; if Test, disp([' recording Ver: ',num2str(v)]), end sample = cell(1,length(Names)); M = menu({'Isolated Word Speech Recognition',' '... ,['Recording Function Version: ',num2str(v)],' '... ,'Choose data type.'}... ,'Training Data.'... ,'Testing Data.'... ,'quit'); if M==1, DT = ['E:\Training Data\',Voc]; end if M==2, DT = ['E:\Training Data\',Voc]; end if M==3, return; end M = menu({'Isolated Word Speech Recognition',' '... ,['Recording Function Version: ',num2str(v)],' '... ,['You are working with: ',DT],' '... ,'What would you like to do?'}... ,'Record a new vocabulary sample set.'... ,'Enter a label for an existing sample set.'... ,'quit'); if M==3, return; end if M==2 filename = [DT,'\voice']; load(filename,'voice'); while 1 U = menu({'Isolated Word Speech Recognition',' '... ,['Recording Function Version: ',num2str(v)],' '... ,['You are working with: ',DT],' '... ,'Which sample set would you like to label?'}... ,['(1) ',voice{1}],['(2) ',voice{2}],['(3) ',voice{3}]... ,['(4) ',voice{4}],['(5) ',voice{5}],['(6) ',voice{6}]... ,['(7) ',voice{7}],['(8) ',voice{8}],['(9) ',voice{9}]... ,'quit'); if U==10, break; end voice{U} = input(['Enter name for ',DT,' set: '... ,num2str(U),' >'],'s'); end filename = [DT,'\voice']; save(filename,'voice'); return; end if M==1 while 1 % listen to one set of vocabulary words msgbox({['Recording Function Version: ',num2str(v)],' ',' '... ,[DT,' Preparation. Say each vocabulary word after the prompt.']}... ,'Isolated Word Speech Recognition','help','replace'); beep; pause(3); for N = 1:length(Names) msgbox({['Recording Function Version: ',num2str(v)],' ',' '... ,[DT,' Set ACTION. Say the word!',' ',Names{N}],' ',' '... ,[' !!! ',Names{N},' !!!']}... ,'Isolated Word Speech Recognition','help','replace'); pause(0.2) sample{N} = wavrecord(1*Fs,Fs,1,'double'); wavplay(sample{N},length(sample{N})); close all hidden; end filename = [DT,'\voice']; load(filename,'voice'); M = menu({'Isolated Word Speech Recognition',' '... ,['Recording Function Version: ',num2str(v)],' '... ,['You are working with: ',DT],' '... ,'Choose a label for this sample set.'}... ,['(1) ',voice{1}],['(2) ',voice{2}],['(3) ',voice{3}]... ,['(4) ',voice{4}],['(5) ',voice{5}],['(6) ',voice{6}]... ,['(7) ',voice{7}],['(8) ',voice{8}],['(9) ',voice{9}]... ,'quit'); if M==10, return; end filename = [DT,'\sample',num2str(M)]; save(filename, 'sample'); M = menu({'Isolated Word Speech Recognition',' '... ,['Recording Function Version: ',num2str(v)],' '... ,['You are working with: ',DT]}... ,'Record a vocabulary sample.'... ,'quit'); if M==2, return; end pause(2); end end
  1 Comment
Andreas Justin
Andreas Justin on 22 Apr 2014
Edited: Andreas Justin on 22 Apr 2014
Could you put a little more effort in the formatting please?
Hint (maybe you can figure it out with this)
Cell contents reference from a non-cell array object
just means that you're trying to get something from an non cell variable like the following.
a = 1:10;
a{1}
Cell contents reference from a non-cell array object.
what you need there is 1* a cell object, or you change 2* the indexing from cell to double
1* a = num2cell(1:10)
a{1}
2* a = 1:10
a(1)

Sign in to comment.

Answers (1)

Jan
Jan on 22 Apr 2014
This is a perfect case for the debugger. Type this in the command window:
dbstop if error
Then run your code again until the error happens. Now check, which variable causes the problem. I guess after load(filename,'voice') the variable "voice" is not a cell, but a struct.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!