필터 지우기
필터 지우기

How to solve 'Index exceeds the number of array elements (1)'

조회 수: 1 (최근 30일)
Lima Parhiz
Lima Parhiz 2019년 10월 21일
댓글: KALYAN ACHARJYA 2019년 10월 25일
Hello
I have to compute the power spectrum of EEG and LFP signals for an assignment. I have written a function for computing the autospectrum and I have to use the imagesc function in order to generate the power spectra. Due to requirements for my assignment, I cannot use the function spectrogram.
Computing the autospectrum values works fine however when I have to plot the spectra, I get the error "Index exceeds the number of array elements (1)". I am writing this for my code for plotting the spectrograms:
% Plotting spectrogram
b = F < 200; % Boolean variable indicating frequency range
figure
imagesc((t(1:min(N_col))/60),F(b),conv2(10*log10(P_norm(b,:)),ones(5,2)/10,'same'))
caxis([-3 3])
set(gca,'YDir','default')
colormap jet
xlabel('Time (min)')
ylabel('Frequency (Hz)')
h=colorbar;
ylabel(h,'Power relative to baseline (dB)')
title([TT.BRAINREGION{j} ', Dose:' num2str(TT.DOSE(j)) 'mg/kg'])
pause
Is there some sort of error in the Imagesc line? I am unsure how to solve the issue.
  댓글 수: 3
Kaashyap Pappu
Kaashyap Pappu 2019년 10월 25일
There is a chance the value of "b" is too high for indexing into an array. However it is hard to say what exactly is causing the error, as the cyclist has already mentioned.
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 10월 25일
Hello Lima,
Please provide the entire code along with data, it can be easily detectable in 1 min, rather than guessing.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 AI for Signals에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by