here is something that might help; for the sake of argument I'm using length 3 rather than 72:
first_scans={1;2;9};
last_scans={3;4;5};
bad_scans={4;7};
fs=cell2mat(first_scans);
ls=cell2mat(last_scans);
bs=cell2mat(bad_scans);
trials=cat(2,fs,ls);
bad_trials=zeros(0,0);
for i=1:size(trials,1)
if any(ismember(bs,trials(i,:)))
bad_trials=cat(2,bad_trials,i);
end
end
disp(bad_trials)