Remove redundant variables. Also change the optional nature of the distance threshold (now mandatory) but leave the model year as optional (when doing climatology).
Change the unique call to preserve the order by replacing first with stable. This requires a relatively modern MATLAB (post-2011b).
Make the announcement of a replaced variable more prominent (shout it!).
Add the time variable to the list of ones to ignore. Also fix the way the time index is calculated to use the hycom time variable.
Remove the (apparently non-existent) density option.