CSC-UW / csc-eeg-tools

Set of matlab functions for EEG io, preprocessing, analysis from the Center for Sleep and Consciousness, University of Wisconsin (csc)
19 stars 7 forks source link

swa-topoplot error concerning y's and x's #16

Closed rverhagen closed 7 years ago

rverhagen commented 7 years ago

Dear @Mensen ,

I have been getting this recurring error when trying to make topographical powerplots using the following lines:

% Plot rms power at key frequency bands for x = 1:3 cmap = colormap('jet'); set(0, 'DefaultFigureColormap', cmap); pngfile = uiputfullfile('.png', 'Select PNG file to create.', DATA_DIR); if x == 1 [powerTopoData1, img] = epi_plot_power_topo_data(eval(strcat(['EEG' num2str(x)])), 'saveFiles', {pngfile}); %figure %topoplot(powerTopoData(:,1), EEG.chanlocs, 'electrodes', 'labels', 'maplimits', 'maxmin') %topoplot(powerTopoData([1:183 185:end],1), EEG.chanlocs, 'electrodes', 'labels', 'maplimits', 'maxmin') %img = epi_plot_power_topo(eval(strcat(['EEG' num2str(x)])), 'saveFiles', {pngfile}); elseif x == 2 [powerTopoData2, img] = epi_plot_power_topo_data(eval(strcat(['EEG' num2str(x)])), 'saveFiles', {pngfile});

else
    [powerTopoData3, img] = epi_plot_power_topo_data(eval(strcat(['EEG' num2str(x)])), 'saveFiles', {pngfile});

end

end

The error is this:

" Error using scatteredInterpolant The number of data point locations should equal the number of data point values.

Error in swa_Topoplot (line 109) F = scatteredInterpolant(xloc,yloc, Data(:), 'natural', 'none');

Error in epi_plot_power_topo_data>epi_plot_power_topo_helper (line 111) swa_Topoplot([], chanlocs, 'Data', powerTopoData(:, b),...

Error in epi_plot_power_topo_data (line 76) figs{i} = epi_plot_power_topo_helper(powerTopoData(:, :, i),... "

Mel solved it by 'commenting' lines 90-93 of the swa-topoplot script:

% if isfield(e_loc(1), 'x') % yloc = cell2mat({e_loc.x}); yloc=yloc(:); % xloc = cell2mat({e_loc.y}); xloc=xloc(:); % else e_loc = swa_add2dlocations(e_loc, GS); yloc = cell2mat({e_loc.x}); yloc=yloc(:); xloc = cell2mat({e_loc.y}); xloc=xloc(:); %end

However, we are not sure what this actually does. Any suggestions whether this is a viable solution?

Thanks,

Ruben

Mensen commented 7 years ago

epi_plot_power_topo_data is not a function within the csc-eeg-tools toolbox... so it may have something to do with the specifics of that script.

I recognise the error though. It happens when the data you are trying to plot is of a different size than the channel locations you are providing to it. Can't help much more than this I'm afraid since the scripts are not mine.