selection_idx = 27900:28000;
timevec = (selection_idx - 1) / fs; %the -1 is because time is assumed to start at 0
plot(timevec, chanPOz(selection_idx), 'b');
marker_to_idx = round(markers * fs) + 1; %the +1 is because time is assumed to start at 0
mask = ismember(marker_to_idx, selection_idx);
selected_markers_idx = marker_to_idx(mask);
selected_markers_time = markers(mask);
selected_markers_y = chanPOz(selected_markers_idx);
plot(selected_markers_time, selected_markers_y, 'r*'); %plot markers as red *