function [newvarin,newchosen] = em_dollyvar(nc, allflag) % called by em_dolly- not for standalone use. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Use of this program is self described. % Program written in Matlab v7.1.0 SP3 % Program ran on PC with Windows XP Professional OS. % % "Although this program has been used by the USGS, no warranty, % expressed or implied, is made by the USGS or the United States % Government as to the accuracy and functioning of the program % and related program material nor shall the fact of distribution % constitute any such warranty, and no responsibility is assumed % by the USGS in connection therewith." %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if running(batch) str = get(batch); eval(['nvarin = ' str ';']); for i = 1:nvarin; str = get(batch); eval(['chosen{i} = ' str ';']); end else % this syntax seems to be the one that works with mexnc for R2006 invars = ncnames(var(nc)); if(allflag) nvarin = length(invars); chosen=invars; else n1=1;n2=1; nvarin = 0; nn=1; endval=length(invars); if length(invars)> 20 nn=ceil(length(invars)/20); end for jj=1:nn if jj==nn endval=n1+mod(length(invars),20)-1; else endval=n1+19; end for i = n1:endval eval (['varlist.',invars{i},'={''checkbox'' 0};']) end vlist = varlist; varlist = guido(vlist,'Which variables should be kept?'); for i = n1:endval eval (['tf = varlist.',invars{i},'{2};']) if tf nvarin = nvarin+1; chosen{n2}=invars{i}; n2=n2+1; end end n1=n1+20 clear varlist end end end % Check for dimension variables. dimvars = strvcat('time','time2','depth','lon','lat'); newvarin = 0; for i = 1:nvarin; dimmatch = strmatch(chosen{i},dimvars,'exact'); if isempty(dimmatch) newvarin = newvarin+1; newchosen{newvarin}=chosen{i}; end end if newvarin == 0; newvarin = nvarin; newchosen = chosen; end