function [FILTEROPT,D] = myxunobsstruct(THIS,D,FILTEROPT)
% MYXUNOBSSTRUCT  [Not a public function] Parse structure with unosbservables estimation specs.
%
% Backend IRIS function.
% No help provided.

% -IRIS Toolbox. 
% -Copyright (c) 2007-2012 Jaromir Benes.

%**************************************************************************

list = fieldnames(D).';
nlist = length(list);
remove = false(1,nlist);
for i = 1 : nlist
    if isempty(D.(list{i}))
        remove(i) = true;
    end
end
D = rmfield(D,list(remove));
list(remove) = [];

[assignpos,stdcorrpos,assignval,stdcorrval,type] = ...
    mynameposition(THIS,list); %#ok<ASGLU>

FILTEROPT.unobslist = list(type == 2);
FILTEROPT.unobspos  = assignpos(type == 2);

D = rmfield(D,FILTEROPT.unobslist);

end