function Vo=getlevels(Z,V); % GETLEVELS Computes vector of levels for contouring purposes % V=getlevels(Z,V) takes the input Z matrix and V argument, % and computes the same V vector generated by the built-in % contouring routines. This is necessary for compatability % reasons. % Author: R. Pawlowicz (IOS) rich@ios.bc.ca % 16/mar/95 if (length(V) <= 1) % Get default contour levels if needed minz = min(min(Z(finite(Z)))); maxz = max(max(Z(finite(Z)))); if isempty(V) CS=contourc([minz maxz ; minz maxz]); else CS=contourc([minz maxz ; minz maxz],V); end ii = 1; % Find the levels Vo = []; while (ii < size(CS,2)), Vo=[Vo CS(1,ii)]; ii = ii + CS(2,ii) + 1; end else Vo=sort(V); % return in ascending order otherwise filling may not work properly end