How do I add channels to exclude while keeping the channels already excluded?

2 visualizaciones (últimos 30 días)
Hi all, I'm having trouble with this piece of code. I'm trying to exclude a whole bunch of channels from a data set, but whenever I try and exclude extras, it ends up undoing the exclusionary criteria. Here's the code:
%% Channel Exclusion
figure;bar(ChanImpedances)
thres = 4*1e6; % set the threshold for the bad channel
hold on,plot(ones(1,length(ChanImpedances))*thres,'r--','LineWidth',2)
bad_channel = [];
bad_channel_o = [];
bad_channel_o = find(ChanImpedances > thres)
bad_channel = find(ChanImpedances > thres)
bad_channel_o = [bad_channel_o;32;128];
bad_channel = [bad_channel;32;128];
So it's already excluding a bunch of channels based upon impedance, but I also want to exclude others based upon visual criteria. Whenever I add:
bad_channel = [46];
It undoes the bad channel selection it just ran. How do I tell it to also exclude channel 46 along with the ones it's already excluded for impedance?
Thank you!

Respuesta aceptada

Star Strider
Star Strider el 4 de Dic. de 2018
If you want to add 46 to the bad channels, probably the easiest way is to ‘grow’ the vector:
bad_channel = [bad_channel; 46];
(This is not great programming practice. In some instances, it works best.)
  2 comentarios
Alexandra Rowan O'Donnell
Alexandra Rowan O'Donnell el 4 de Dic. de 2018
Thank you! I actually ended up adding it to this line and it worked.
bad_channel_o = [bad_channel_o;32;46;128];
bad_channel = [bad_channel;32;46;128];
It wasn't running properly because bad_channel is recalled further down for interpolation and that's where it screws up.
Star Strider
Star Strider el 4 de Dic. de 2018
As always, my pleasure!
If the order is important, efficiency is secondary, and you want them sorted ascending (lowest first), you can add them whenever you want, then use:
bad_channel = sort(bad_channel);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre RF Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by