/* remove windows with no series */
_remempty_winlist(inlist, nowin)
{
local k, wlist, wstr, tstr;
if (argc < 2)
{
nowin = 0;
}
k = 1;
wlist = "";
while (1)
{
tstr = strget(k, inlist, ",");
if (strlen(tstr) == 0)
{
break;
}
wstr = tstr;
if (nowin)
{
/* just check window existence */
if (castint(wstr) <= numwindows())
{
wlist += tstr + ",";
}
}
else
{
/* check empty windows */
if (eval(sprintf("isscalar(%s)", tstr)))
{
wstr = "W" + tstr;
}
if (eval(sprintf("length(%s)", wstr)) > 0)
{
wlist += tstr + ",";
}
}
k++;
}
/* remove trailing comma */
wlist = strextract(wlist, 1, strlen(wlist) - 1);
return(wlist);
}