Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in UIControl Callback #9

Open
lhobson13 opened this issue Apr 11, 2019 · 3 comments
Open

Error in UIControl Callback #9

lhobson13 opened this issue Apr 11, 2019 · 3 comments

Comments

@lhobson13
Copy link

I get the following error when processing my file, and I'm not sure why. My .wav files should all be the same but I get this error on a couple of them when I try to process the file.

The logical indices in position 2 contain a true value outside of the array bounds.

Error in syllable_activity_file_stats (line 72)
syllable_data=syllable_data(:,syllable_use==1);

Error in compute_musv (line 93)
[syllable_data, syllable_stats, filestats] = syllable_activity_file_stats(handles, audiofile,
TotNbFrames, syllable_data);

Error in process_file (line 7)
[syllable_data, syllable_stats, filestats,
fs]=compute_musv(wav_dir,wav_items(selected_wav),handles);

Error in processAudioFile_Callback (line 2)
handles=process_file(handles);

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)processAudioFile_Callback(hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.

@mvansegbroeck-zz
Copy link
Owner

Can you share a wav file for us to reproduce and debug this issue?

@chaichontat
Copy link

Hi, we are also experiencing this issue. Here are the files. Thanks!

@kschenk1
Copy link

kschenk1 commented Jun 17, 2020

I have fixed this problem.
FIX:
Find the following lines in the file "syllable_activity_file_stats.m" :
if isempty(syllable_use)
syllable_use=ones(1,length(syllable_data));
end
and replace them with the following
if isempty(syllable_use)
syllable_use=ones(1,size(syllable_data,2));
end
Save the new version of the code and rerun.

Explaination:
The problem is that the cell array "syllable_data" has 9 rows and a number of columns equal to the number of detected calls in the file. The errors you pasted above come from the lines in "syllable_activity_file_stats.m" where the variable "syllable_use" is defined. Those lines are:
if isempty(syllable_use)
syllable_use=ones(1,length(syllable_data));
end
If the number of syllables is less than 9, the length function will return the number 9 (it returns the max of the size of the array) and not the number of columns. Then, when it is used in the line
syllable_data=syllable_data(:,syllable_use==1);
it will try to access 9 columns when there are only less than that and it will throw and error.

For example, say a file has 8 calls. Then the size of "syllable_data" will be (9,8), i.e., 9 rows and 8 columns (one for each syllable). Then length(syllable_data) will return 9 instead of 8. Then when the line syllable_data=syllable_data(:,syllable_use==1); is executed, it will throw an error since it is trying to access 9 columns of the data when there are only 8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants