MATLAB: Filter out incorrect responses

MATLABoutliers

If I have a dataset, in which the correct response was 1 and the incorrect response was 0, how can I filter out the participants with incorrect responses? I have to write this as a script in matlab.
Thanks.

Best Answer

If the responses are integers, and if I understand your problem correctly, this will work:
subjects = 1:10;
responses = randi([0 1], 1, 10);
subj_resp = [subjects; responses]
keep_responses = find(responses == 1)
subj_resp =
1 2 3 4 5 6 7 8 9 10
0 1 0 1 1 0 1 0 0 1
keep_responses =
2 4 5 7 10