function fillvoid(num,action);
% fill the titles and ylabels according to variable properties
global xhand xnum whichfile ncf initialplot whichnew whereat xfnew

varia=get(xhand.varpanedit(num),'string');
set(xhand.ylimedit(num),'string', '' );
initialplot=1;
switch action

case 'keybd'
	
	if isempty(spacebuster(varia))
		whichfile(num,:)=0;
		set(xhand.titpanedit(num),'string', '' );
		set(xhand.ypanedit(num),'string', '' );
		return;
	end;
	[s,ss]=strtok(varia,'[]');
	i=0;
	while ~isempty(s)
		i=i+1;
		[t{i},s]=strtok(s,' ,');
	end;
	j=length(find(whichfile(num,:)>0));
	if i>j
		for kk=j+1 : i
			[indx,pick]=search(t{kk});
			if pick=='all'
				whichfile(num,kk)=xnum.file;
				whichnew.graph(num,kk)=0;
			elseif pick=='new'
				whichnew.graph(num,kk)=indx;
				whichfile(num,kk)=10+whereat(indx);
				if ~isempty(findstr(t{kk},'_avg'))
					whichfile(num,kk)=20+whereat(indx);
				elseif ~isempty(findstr(t{kk},'_sub'))
					whichfile(num,kk)=30+whereat(indx);
				elseif ~isempty(findstr(t{kk},'_merg'))
					whichfile(num,kk)=40+whereat(indx);
				elseif ~isempty(findstr(t{kk},'_f33'))
					whichfile(num,kk)=50+whereat(indx);
				elseif ~isempty(findstr(t{kk},'_filt'))
					whichfile(num,kk)=60+whereat(indx);
				elseif ~isempty(findstr(t{kk},'_f2f'))
					whichfile(num,kk)=70+whereat(indx);
				elseif ~isempty(findstr(t{kk},'_fh'))
					whichfile(num,kk)=80+whereat(indx);
				elseif strcmpi(suffixstr,'_brdg')
					whichfile(pan,i+1)=90+whereat(xnum.newvarlist);
				end;
			end;
		end;
	elseif j>i
		whichfile(num,i+1 : j)=0;
		whichnew.graph(num,i+1)=0;
	end;
	if isempty(findstr(ss,']'))
		tit=strrep(varia,'_','\_');
		name=t{1};
	else
		tit='Vector';
		name=strtok(varia,'[ ,');
	end;
	
	ylab=unitfinder(num,name);
		
	if length(tit)==1
		tit=upper(tit);
	end;
	set(xhand.titpanedit(num),'string', tit );
	set(xhand.ypanedit(num),'string', ylab );

case 'mouse'
	tit=strrep(varia,'_','\_');
	if length(tit)==1
		tit=upper(tit);
	end;
	[varia,s]=strtok(spacebuster(varia),'+ ,');
	
	ylab=unitfinder(num,varia);
	
	set(xhand.titpanedit(num),'string', spacebuster(tit) );
	set(xhand.ypanedit(num),'string', ylab );
end %switch
return;


function ylab=unitfinder(num,varia)
% function to find the unit attribute to be used as Ylabel in plots
global whichfile whichnew ncf xfnew

ylab='';
newvnum=whichnew.graph(num,1);
if newvnum==0 % variables not from the newwindow
	ylab=att(ncf(whichfile(num,1)).file{varia});
	if ~isempty(ylab)
		indx=find(strcmp(ncnames(ylab),'units'));
		ylab=ylab{indx}(:);
	end;
else
	ylab=xfnew(newvnum).attname;
	if ~isempty(ylab)
		indx=find(strcmp(ylab,'units'));
		ylab=xfnew(newvnum).att{indx};
	end;
end;

return;

