Index exceeds the number of array elements (8000).

조회 수: 1 (최근 30일)
Mohamed Mahir
Mohamed Mahir 2021년 4월 9일
댓글: Walter Roberson 2025년 3월 7일
Error in autodecoder_freq (line 35)
x = [signal(950:1450), signal(2100:2600), signal(3150:3650), signal(4200:4700), signal(5250:5750), signal(6350:6850), signal(7400:7900), signal(8500:9000), signal(9600:10100),
signal(10600:11100), signal(11750:12250), signal(12800:13300)];
N = 512;
% aproximate frequency interval
lowfreq = [650 733 811 897 1000];
highfreq = [1000 1273 1407 1515];
% tone frequency dictionaries
dic_low = [697 770 852 941];
dic_high = [1209 1336 1477];
% digited numbers
tele = [1,2,3; 4,5,6; 7,8,9; 11,0,12]; % '*' = 11; '#' = 12
[signal, fs] = audioread('DialedNumber.wav');
fN=fs/2; % Nyquist frequency
playout = audioplayer(signal,fs);
play(playout);
figure(1)
plot (signal)
title('Signal')
xlabel('Time')
ylabel('Magnitude')
% 12 column matrix of the signal (stable part of the signal segments)
x = [signal(950:1450), signal(2100:2600), signal(3150:3650), signal(4200:4700), signal(5250:5750), signal(6350:6850), signal(7400:7900), signal(8500:9000), signal(9600:10100), signal(10600:11100), signal(11750:12250), signal(12800:13300)];
  댓글 수: 1
Walter Roberson
Walter Roberson 2025년 3월 7일
% aproximate frequency interval
lowfreq = [650 733 811 897 1000];
highfreq = [1000 1273 1407 1515];

댓글을 달려면 로그인하십시오.

답변 (1개)

Harshavardhan
Harshavardhan 2025년 3월 7일
The error message indicates that your code is attempting to access elements in the array that do not exist. This typically happens when the indices specified are beyond the length of the array.
To resolve this issue, you can first check the length of the signal array. You can do this by adding a line of code to display the length of signal:
disp(['Length of signal: ', num2str(length(signal))]);
Once you know the length of the signal, ensure that all the indices you are trying to access are within this range.
You can find more information about “length” below:

카테고리

Help CenterFile Exchange에서 Array Geometries and Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by