function [velocities,arglist] = parseVelocities(positions,arglist)
%parseVelocities parse argument list for velocity information
%   This file is for internal use only and may be removed in a future
%   version of MATLAB

%   Copyright 2017 The MathWorks, Inc.

velocities = [];
i = 1;
while i<=numel(arglist)
    data = arglist{i};
    if isnumeric(data) && numel(size(data)) ~= 3
        if isequal(size(positions),size(data))
            velocities = double(data);
            arglist(i) = [];
            break
        elseif (~isvector(data) || numel(data) ~= size(positions,1)) && ...
                 (size(positions,1)~=1 || ~isequal(size(data),[3 3]))
            error(message('shared_radarfusion:theaterPlot:PositionVelocityMismatch'));
        end
    end
    i = i+1;
end
