Newer
Older
function shipVelocity( hMainFig )
%
% Compute the ship velocity
%
% Get the data from the application GUI
% -------------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
% Compute ship velocity from positions if sog not available
% ---------------------------------------------------------
if isempty(tsg.SPDC)
range = m_lldist(tsg.LONX,tsg.LATX);
ind = size(tsg.DAYD);
tsg.SPDC = zeros(size(ind));
for i=1:length(tsg.DAYD)-1
tsg.SPDC(i) = range(i) / ((tsg.DAYD(i+1)-tsg.DAYD(i)) * 24 * 1.854);
end
tsg.SPDC = [tsg.SPDC';0];
end
% Save tsg structure
% ------------------
setappdata( hMainFig, 'tsg_data', tsg);
end