function inds = vfinds(Ns)

P = length(Ns);

inds = cell(1,P);

for p=1:P
    
    Iu = indsunique(Ns(p),p);
    inds{p}.Su = cell2mat(myind2sub(Ns(p)*ones(1,p),Iu));    
    
    inds{p}.inonN = inonn(inds{p}.Su, Ns(p));
    
    inds{p}.inon1 = inonn(inds{p}.Su, 1);
    
    inds{p}.i1 = in(inds{p}.Su, 1);
end



function ii = in(S, n)
ii = zeros(size(S,1),1);

for q=1:size(S,2)
    ii = ii | S(:,q) == n;
end
ii = find(ii);



function ii = inonn(S, n)
ii = in(S, n);

ii = setdiff((1:size(S,1)),ii);
ii = ii(:);
