index channel location error
Show older comments
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 Comments
Walter Roberson
on 2 Jul 2021
Your EEG is a non-scalar struct. You can only index one level into it.
It is not clear that EEG(K).chanlocs is a scalar struct itself, or that EEG(K).chanlocs(1).labels is scalar, and those things will matter for producing useful code.
Carmen Sergiou
on 2 Jul 2021
Walter Roberson
on 2 Jul 2021
Your EEG is nonscalar struct. Each entry of it contains the nonscalar struct chanlocs. Each chanlocs contains labels which is a character vector.
When you do the find() are you asking to identify the EEG index for which some chanlocs.labels matches? Or are you asking to identify the chanlocs index that matches for some EEG? If you are trying to identify the J, K pair for which EEG(J).chanlocs(K).labels matches then you cannot do that with a single find()
Carmen Sergiou
on 2 Jul 2021
Walter Roberson
on 2 Jul 2021
Are the labels the same for all EEG entries?
Carmen Sergiou
on 5 Jul 2021
Accepted Answer
More Answers (0)
Categories
Find more on EEG/MEG/ECoG in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!