-
leprob001 authored
Bugfix: When soundsource has been applied, the zoom function was not functioning anymore. Toa table: It is now possible to select the duplicates in the toa table, and the the plot will zoom to it.
leprob001 authoredBugfix: When soundsource has been applied, the zoom function was not functioning anymore. Toa table: It is now possible to select the duplicates in the toa table, and the the plot will zoom to it.
getDuplicateAppliedDates.m 1.18 KiB
function [duplicateDates, duplicateToas] = getDuplicateAppliedDates(pSoundsource, pToaData)
%GETDUPLICATEAPPLIEDDATES Collects all dates that have been applied multiple times to the soundsource.
% Returns two cells with indices consistent to each other.
%
% Parameters:
% pSoundsource (struct): The soundsource details.
% pToaData (struct): The TOA data.
%
% Returns:
% duplicateDates (cell): Containing all rafos dates where
% multiple applications have been found.
% duplicateToas (cell): Contains all toas that are found.
%% Get required data
name = pSoundsource.sourcename;
selection = strcmp(pToaData.soundSource, name);
toaDates = pToaData.toaDate(selection);
toa = pToaData.toa(selection);
%% Collect duplications
[~, ind] = unique(toaDates);
duplicateIndices = setdiff(1:size(toaDates, 1), ind);
duplicateDates = cell(length(duplicateIndices), 1);
duplicateToas = cell(length(duplicateIndices), 1);
%% Get all duplicate toas
for i = 1:length(duplicateIndices)
index = duplicateIndices(i);
duplicateDates(i) = {toaDates(index)};
duplicateToas(i) = {toa(toaDates == duplicateDates{i})};
end
end