lists all names of subjects who have at least one trial with a response time value larger than 2.5 in matlab

You can use logical indexing in MATLAB to achieve this. Given a matrix M containing the response time of each trial for each subject, you can create a logical index of trials that have a response time greater than 2.5:

main.m
response_times = ... % matrix M of response times
index = response_times > 2.5;
80 chars
3 lines

Then, you can apply the any function along the rows of this logical index to determine if there is at least one trial with a response time greater than 2.5 for each subject:

main.m
has_response_gt_25 = any(index, 2);
36 chars
2 lines

Finally, you can use this logical index to filter the list of subject names:

main.m
subjects = ... % cell array of subject names
selected_subjects = subjects(has_response_gt_25);
95 chars
3 lines

If you want to use a for-loop instead of any, you can do:

main.m
has_response_gt_25 = false(size(M, 1), 1);
for i = 1:size(M, 1)
    if any(M(i, :) > 2.5)
        has_response_gt_25(i) = true;
    end
end
140 chars
7 lines

gistlibby LogSnag