Problem with ismember evaluating values in matrix
1 view (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
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
Image Analyst
on 13 Sep 2013
See the FAQ: http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F
Cast to integers, or else compare to within a tolerance if you're going to compare floating point numbers (double, single).
See Also
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!