Find in cell array

2 次查看(过去 30 天)
hamed
hamed 2017-9-25
评论: hamed 2017-9-25
Hi all
I have 2 cell arrays.
one of them is my EEG bad channels and another is all EEG channels.
I want to find row numbers of the bad channels in my all EEG channels. For example, I have c4 in my bad channels and c4 in all channels file is 35.
and Fp2 is 3 in all channels. I want to do it by code. I've tried with:
idx = find(ismember(A,B))
but it works just when I put B in '' for instance:
idx = find(ismember(all_channels,'C4')) %ismember is case sensitive
I've attached my .mat files.
would you please help me.
Hamed

采纳的回答

KL
KL 2017-9-25
编辑:KL 2017-9-25
ind = cellfun(@find,cellfun(@(c) strcmp(all_channels,c),bad_channels,'uni',0))
  3 个评论
KL
KL 2017-9-25
See my edited answer. This should do what you want.
hamed
hamed 2017-9-25
yes, it works perfectly
Thanks a lot for your help

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 EEG/MEG/ECoG 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by