Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
Lima Parhiz
Lima Parhiz el 21 de Oct. de 2019
Comentada: KALYAN ACHARJYA el 25 de Oct. de 2019
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 comentarios
Kaashyap Pappu
Kaashyap Pappu el 25 de Oct. de 2019
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 el 25 de Oct. de 2019
Hello Lima,
Please provide the entire code along with data, it can be easily detectable in 1 min, rather than guessing.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre AI for Signals en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by