You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: visualizeRawData.m
    path of file: ./repos/OMEGA/source
    
    the code of the file until where you have to start completion: function visualizeRawData(data, detectors, varargin)
%VISUALIZERAWDATA Raw data visualization
%   Visualizes the raw list-mode data created by load_data. Input the raw
%   data and the total number of detectors on the machine. Optionally input
%   a sequence of rings from where to visualize along with the total number
%   of rings.
%
% Examples:
%   visualizeRawData(coincidences{1}, options.detectors)
%   visualizeRawData(coincidences{1}, options.detectors, 3:8, 80)

[K, ~, V] = find(data);
L = find(tril(true(detectors,detectors), 0));
L = L(K);

    
function visualizeRawData(data, detectors, varargin)
%VISUALIZERAWDATA Raw data visualization
%   Visualizes the raw list-mode data created by load_data. Input the raw
%   data and the total number of detectors on the machine. Optionally input
%   a sequence of rings from where to visualize along with the total number
%   of rings.
%
% Examples:
%   visualizeRawData(coincidences{1}, options.detectors)
%   visualizeRawData(coincidences{1}, options.detectors, 3:8, 80)

[K, ~, V] = find(data);
L = find(tril(true(detectors,detectors), 0));
L = L(K);

[I,J] = ind2sub([detectors detectors], L);
clear L
true_coincidences = sparse(I,J,V,detectors,detectors);
clear I J V

figure
if isempty(varargin)
    imagesc(true_coincidences)
else
    det_per_ring = detectors / varargin{2};
    alku = varargin{1}(1) - 1;
    if length(varargin{1}) == 1
        loppu = alku + 1;
    else
        loppu = varargin{1}(end