function show_blocks( times_use, t_seg, xx_vec, n_seg ) % function show_blocks( times_use, t_seg, xx_vec, n_seg ) global spill_count data_bins line_width = 2; plot_sym = '-b'; micro2sec = 1.e-6; % convert microseconds to seconds num_segs = length( t_seg ); t_seg_1 = [ times_use(1); t_seg(1:num_segs-1) ]; t_seg_2 = t_seg; tt_even = data_bins; dt_bin = tt_even(2) - tt_even(1); tp_min = min( tt_even ); tp_max = max( tt_even ); xx = hist_fast( times_use, tt_even ); if spill_count > 1 xx = spill_count * xx; end plot( micro2sec * tt_even, zeros(size(tt_even)), '-k') plot_max = max( 1000 * xx / dt_bin ); hold on plot( micro2sec * tt_even, 1000 * xx / dt_bin, '-r') % Plot Blocks num_blocks = length( t_seg_1 ); if num_blocks > 0 for id = 1:num_blocks % Left side: xx_plot = micro2sec * [ t_seg_1(id) t_seg_1(id) ]; yy_plot = 1000 * [ 0 xx_vec(id) ]; hh = plot( xx_plot, yy_plot, '-g'); % Right side xx_plot = micro2sec * [ t_seg_2(id) t_seg_2(id) ]; yy_plot = 1000 * [ xx_vec(id) 0]; hh = plot( xx_plot, yy_plot, '-g'); xx_plot = micro2sec * [ t_seg_1(id) t_seg_2(id) ]; yy_plot = 1000 * [ xx_vec(id) xx_vec(id) ]; hh = plot( xx_plot, yy_plot, plot_sym); % dxp = 0.2* ( xx_plot(2) - xx_plot(1) ); % dyp = 0.01 * plot_max; % if or23(id) ~= 1 % text( xx_plot(1)+dxp, yy_plot(1)+dyp, int2str( or23(id) ) ) % end if xx_vec(id) == 0 set(hh,'LineWidth',.5) else set(hh,'LineWidth', line_width ) end if max( yy_plot ) > plot_max plot_max = max( yy_plot ); end end end v=axis; v(1) = micro2sec * tp_min; v(2) = micro2sec * tp_max; v(3) = 0; v(4) = 1.05 * plot_max; axis(v) title(sprintf('Num blocks: %3.0f', num_blocks ) ) hold off drawnow