Problem with ismember evaluating values in matrix

1 view (last 30 days)
I have an array with the following values:
EEG.event(1).type = 202
EEG.event(2).type = 24
EEG.event(3).type = 101
respMarkers = [10 20 101 102];
When I run this statement:
(~ismember([EEG.event(3).type], respMarkers))
I expect the result to be false, but it comes out true. Since 101 is contained within the respMarkers variable, why does this occur?

Answers (1)

Image Analyst
Image Analyst on 13 Sep 2013
It comes out false for me, as expected because ismember([EEG.event(3).type], respMarkers) is true. Are you sure you're looking at the correct expression with the ~ tilde in the right place?
  3 Comments
Ryan
Ryan on 13 Sep 2013
I just typed in just the code I gave you, and it comes out false as well. Thus, EEG has a different variable type for my actual data (I'm loading in EEG data from a data file). What can I do to fix this?
Image Analyst
Image Analyst on 13 Sep 2013
Cast to integers, or else compare to within a tolerance if you're going to compare floating point numbers (double, single).

Sign in to comment.

Categories

Find more on EEG/MEG/ECoG in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!