function union_of_indices=ExtractIndices(ind);
if ~iscell(ind)
    if isfield(ind,'indices')
        union_of_indices=ind.indices;
    else
        union_of_indices=ind.setlist{1};
    end
else
    union_of_indices=[];
    for i=1:length(ind.indices)
        union_of_indices=union(union_of_indices,ind.indices{i});
    end
end
