[Eeglablist] Similar function equals topoplot() who generates directly rgb matrix from topographic map
Victor Gimenez
victor.gimenez at ufabc.edu.br
Tue Apr 19 02:18:57 PDT 2022
Good Morning/Afternoon/Evening dear EEGLab community,
Is there another function that performs the same role as the topoplot()
function? I have realized that topoplot() despite meeting my
expectations, when it is executed through loop(s) it may be slow and
computational costly, I am doing:
clear all
set(0,'DefaultFigureVisible','off');
%%%%
%%%% code lines here before %%%%
%%%%
count = 1; %12561
for p2 = 1:trials_a %785
for p1 = 1:16
figHandle = figure;
topoplot(a_data(p1,:,p2),EEG.chanlocs,'style','map'); %loop
[X, Map] = frame2im(getframe(figHandle)); %Generates rgb matrix
from topographic map topoplot
a_data{count} = X;
label_a_final(:,count) = 1;
%FFT
Y = fft(a_data(p1,:,p2));
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
figHandle = figure;
topoplot(P1(i_fft),EEG.chanlocs,'style','map');
[X_fft, Map_fft] = frame2im(getframe(figHandle)); %Generates rgb
matrix from topographic map topoplot
a_data_fft_final{count} = X_fft;
count = count + 1;
end
end
%%%%
%%%% code lines here before %%%%
%%%%
%%%% set(0,'DefaultFigureVisible','on');
And when I did/do this nested for loop the IDE crashed up and I was
supposed to force the shutdown immediately, consider that a_data,
a_data_fft_final are already preallocated before these loops. I am
trying to think about ways to vectorize this code but I unfortunately
can't able to think about the best manner for it.
With best wishes,
Victor
More information about the eeglablist
mailing list