Skip to content
Snippets Groups Projects
plotTrajectoryReferencePositions.m 1.33 KiB
Newer Older
function [scatterHandles, textHandles] = plotTrajectoryReferencePositions(pAxesHandle, pTrajectory, pColor, pPlotAsMap)
%PLOTTRAJECTORYREFERENCEPOSITIONS Summary of this function goes here
%   Detailed explanation goes here

%% Prepare variables
referencePositions = pTrajectory.trackParameter.soundsourceCombinations.referencePosition;
referencePositions = cellfun(@strsplit, referencePositions, 'UniformOutput', false);
referencePositions = cellfun(@str2double, referencePositions, 'UniformOutput', false);
referencePositions = cell2mat(referencePositions);

x = referencePositions(:, 2);
y = referencePositions(:, 1);

%% Plot

% make handle the current axes
axes(pAxesHandle);

if pPlotAsMap
    scatterHandles = scatterm(pAxesHandle, y, x, [], pColor, 'x');
else
    scatterHandles = scatter(pAxesHandle, x, y, [], pColor, 'x');
end
textHandles = cell(1, length(x));
if pPlotAsMap
    for i = 1:length(x)
        textHandles{i} = textm( ...
            y(i), x(i), {'', [' ' num2str(pTrajectory.id) '.' num2str(i)]}, ...
            'Color', pColor ...
        );
    end
else
    for i = 1:length(x)
        textHandles{i} = text( ...
            pAxesHandle, x(i), y(i), {'', [' ' num2str(pTrajectory.id) '.' num2str(i)]}, ...
            'Color', pColor ...
        );
    end