From 56e2c299b4b0a1f05bc416da505cb0d145b41530 Mon Sep 17 00:00:00 2001 From: ftadel Date: Tue, 26 May 2020 13:53:46 +0200 Subject: [PATCH] Bugfix: Allow montages based on all channels instead of figure channels only --- toolbox/gui/panel_montage.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/toolbox/gui/panel_montage.m b/toolbox/gui/panel_montage.m index d8adde319..a82547ec5 100644 --- a/toolbox/gui/panel_montage.m +++ b/toolbox/gui/panel_montage.m @@ -1188,10 +1188,12 @@ function DeleteMontage(MontageName) % Get channels displayed in this figure iFigChannels = GlobalData.DataSet(iDS).Figure(iFig).SelectedChannels; FigChannels = {GlobalData.DataSet(iDS).Channel(iFigChannels).Name}; + AllChannels = {GlobalData.DataSet(iDS).Channel.Name}; FigId = GlobalData.DataSet(iDS).Figure(iFig).Id; isStat = strcmpi(GlobalData.DataSet(iDS).Measures.DataType, 'stat'); % Remove all the spaces FigChannels = cellfun(@(c)c(c~=' '), FigChannels, 'UniformOutput', 0); + AllChannels = cellfun(@(c)c(c~=' '), AllChannels, 'UniformOutput', 0); % Get the predefined montages that match this list of channels iMontage = []; for i = 1:length(GlobalData.ChannelMontages.Montages) @@ -1248,7 +1250,7 @@ function DeleteMontage(MontageName) % Skip montages that have no common channels with the current figure (remove all the white spaces in the channel names) curSelChannels = GlobalData.ChannelMontages.Montages(i).ChanNames; curSelChannels = cellfun(@(c)c(c~=' '), curSelChannels, 'UniformOutput', 0); - if ~isBadMontage && ~isempty(curSelChannels) && (length(intersect(curSelChannels, FigChannels)) < 0.3 * length(curSelChannels)) % We need at least 30% of the montage channels + if ~isBadMontage && ~isempty(curSelChannels) && (length(intersect(curSelChannels, AllChannels)) < 0.3 * length(curSelChannels)) % We need at least 30% of the montage channels continue; end % Remove the re-referencing montages when the reference is not available