How to solve 'Index exceeds the number of array elements (1)'
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Kaashyap Pappu
il 25 Ott 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
il 25 Ott 2019
Hello Lima,
Please provide the entire code along with data, it can be easily detectable in 1 min, rather than guessing.
Risposte (0)
Vedere anche
Categorie
Scopri di più su AI for Signals in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!