index channel location error
3 次查看(过去 30 天)
显示 更早的评论
chan1idx = find(strcmpi(channel1,{EEG.chanlocs.labels}));
chan2idx = find(strcmpi(channel2,{EEG.chanlocs.labels}));
Dear all, I am trying to direct the index of channel 1 to the corresponding value in my EEG.chanlocs file.
But I keep on getting this error:
Intermediate dot '.' indexing produced a comma-separated list with 20 values, but
it must produce a single value to perform subsequent indexing operations.
What should I change?
Thanks!!
6 个评论
采纳的回答
Walter Roberson
2021-7-7
channel1 = 'Fz';
EEG(1).chanlocs = struct('labels', {'Fp1', 'Fz', 'F3'}, 'sph_theta', {18, 0, 39})
EEG(2).chanlocs = struct('labels', {'Fp1', 'Fz', 'F3'}, 'sph_theta', {68, 44, 90});
EEG(3).chanlocs = struct('labels', {'Fp1', 'Fz', 'F3'}, 'sph_theta', {-17, 23, 45});
fields = {EEG(1).chanlocs.labels}
[found_channel1, idx] = ismember(channel1, fields)
So now if found_channel1 is true then idx is valid and is the field number of channel1 in EEG(:).chanlocs .
This assumes that the channel labels are exactly the same for all EEG(K).chanlocs .
extracted_info = cell2mat(arrayfun(@(S) S.chanlocs(idx), EEG, 'uniform', 0))
{extracted_info.labels}
[extracted_info.sph_theta]
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 EEG/MEG/ECoG 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!