How to fix Index exceeds array bounds?

3 ビュー (過去 30 日間)
Leonidas Daedalus
Leonidas Daedalus 2018 年 12 月 7 日
再開済み: Walter Roberson 2018 年 12 月 20 日
%% Visualize Data
% Plot the waveforms and spectrograms of a few training examples. Play the
% corresponding audio clips.
specMin = min(XTrain(:));
specMax = max(XTrain(:));
idx = randperm(size(XTrain,2),3);
figure('Units','normalized','Position',[0.2 0.2 0.6 0.6]);
for i = 1:3
[x,fs] = audioread(adsTrain.Files{idx(i)});
subplot(1,2,i)
plot(x)
axis tight
title(string(adsTrain.Labels(idx(i))))
subplot(2,3,i+3)
spect = XTrain(:,:,1,idx(i));
pcolor(spect)
caxis([specMin+2 specMax])
shading flat
sound(x,fs)
pause(2)
end
I want to plot the audio waveforms and spectograms but it gives me error. Am I missing something?
Index exceeds array bounds.
Error in DeepLearningSpeechRecognitionExample (line 117)
[x,fs] = audioread(adsTrain.Files{idx(i)});

回答 (1 件)

Cris LaPierre
Cris LaPierre 2018 年 12 月 7 日
It means your code is indexing to a non-existant location in either idx or adsTrain.Files.
You can read more here.

カテゴリ

Help Center および File ExchangeTime-Frequency Analysis についてさらに検索

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by