function [handleTimeDivergenceToGps, handleLegend] = plotTimeDivergenceToGps(pAxesHandle, pTrajectory) %PLOTTIMEDIVERGENCETOGPS Summary of this function goes here % Detailed explanation goes here %% Setup return variables handleTimeDivergenceToGps = struct(); %% Get required data fnames = fieldnames(pTrajectory.timeDivergenceToGps); legendText = {}; %% Clear axes cla(pAxesHandle); %% Plot data hold(pAxesHandle, 'on'); for i = 1:length(fnames) current = pTrajectory.timeDivergenceToGps.(fnames{i}); x = current(:, 1); y = current(:, 2); handleTimeDivergenceToGps.(fnames{i}) = plot(pAxesHandle, x, y, '.-'); legendText{i} = fnames{i}; end hold(pAxesHandle, 'off'); %% Setup legend handleLegend = legend(pAxesHandle, legendText); end