function [lat, lon] = FindLatLon(matFilename)
    %gives the lat/lon boundaries of the given site filename
    %e.g. [lat, lon] = FindLatLon("Site5N.mat") 
    % Load the .mat file containing the variables
    data = load(matFilename);
    
    % Extract variables from the loaded data
    co_sar = data.co_sar;
    mask = data.mask;
    sar_filenames = data.sar_filenames;
    
    % Create an RGB version of the grayscale image
    sar_rgb = repmat(co_sar(:,:,1), [1, 1, 3]);
    
    % Define the highlight color, e.g., red [1 0 0]
    highlight_color = [1 0 0]; % Red color
    
    % Apply the highlight color to the masked areas
    for k = 1:3
        channel = sar_rgb(:,:,k); % Extract the k-th color channel
        channel(mask) = highlight_color(k); % Apply the color to the masked area
        sar_rgb(:,:,k) = channel; % Put the modified channel back
    end
    
    % Display the highlighted image
    figure;
    imshow(sar_rgb);
    title('Highlighted Masked Areas in Color');
    
    % Extract the first filename from the list
    sar_filename = sar_filenames{1};
    
    % Replace 'BISQH' with 'BINQ' for latitude filename and 'BITQ' for longitude filename
    lon_filename = strrep(sar_filename, 'BIS', 'BIN'); % Latitude filename
    lat_filename = strrep(sar_filename, 'BIS', 'BIT'); % Longitude filename
    
    % Load the original SAR data and the latitude and longitude data
    sar_data = importdata(sar_filename);
    lat_data = importdata(lat_filename);
    lon_data = importdata(lon_filename);
    
    % Perform template matching using normxcorr2
    c = normxcorr2(co_sar(:,:,1), sar_data(:,:,1));
    
    % Find the peak in cross-correlation
    [ypeak, xpeak] = find(c==max(c(:)));
    
    % Account for the padding that normxcorr2 adds
    yoffSet = ypeak-size(co_sar,1);
    xoffSet = xpeak-size(co_sar,2);
    
    % Create a new mask of zeros with the same size as 'sar_data'
    new_mask = false(size(sar_data(:,:,1)));
    
    % Place the 'mask' at the correct location in 'new_mask' using the offsets
    new_mask(yoffSet+1:yoffSet+size(co_sar,1), xoffSet+1:xoffSet+size(co_sar,2)) = mask;
    
    % Apply the new mask to the latitude and longitude matrices
    masked_lat = lat_data(new_mask);
    masked_lon = lon_data(new_mask);
    
    % Find the max/min latitude and longitude in the masked area
    lat(1) = min(masked_lat(:));
    lat(2) = max(masked_lat(:));
    lon(1) = min(masked_lon(:));
    lon(2)= max(masked_lon(:));

    lon = 360-lon;
    
end