function ac = vcutadcp( a, ii)
% function ac = vcutadcp( a, ii)
% Returns subset of "a" with vertical indices ii.
% It would be nice to have a more automated way of doing this.

% This initialization is not necessary, but it ensures that
% the order of the fields remains the same, even if they are
% changed in read_os.
%
% this is a hack from cutadcp; just keep adding "if(isfield)"
ac = a;


if isfield(a, 'vel'),    ac.vel =     a.vel(ii, :, :); end
if isfield(a, 'amp'),    ac.amp =     a.amp(ii, :, :); end
if isfield(a, 'pg'),     ac.pg =      a.pg(ii, :, :); end
if isfield(a, 'cor'),    ac.cor =     a.cor(ii, :, :); end
if isfield(a, 'sw'),     ac.sw =      a.sw(ii, :, :); end
if isfield(a, 'rssi'),   ac.rssi =    a.rssi(ii, :, :); end
if isfield(a, 'enu'),    ac.enu =     a.enu(ii, :, :); end
if isfield(a, 'xyze'),   ac.xyze =    a.xyze(ii, :, :); end
if isfield(a, 'status'), ac.sw =      a.sw(ii, :, :); end
if isfield(a, 'HiV'),    ac.HiV =     a.sw(ii, :, :); end
if isfield(a, 'XmtAmps'),ac.XmtAmps = a.sw(ii, :, :); end

if (isfield(a, 'depth'))
   ac.depth = a.depth(ii);
end
