function inds = nextinds(inds,N)
% NEXTINDS Increments the multi-index array inds in the lexicographical order.
% 
%The minimum value for each component is zero, and
%the maximum is N-1. When the maximum multi-index (N-1,...,N-1) is reached,
%the function outputs a null vector of same dimension as inds.
%
%  Input arguments:
%
%  inds : multi-index vector with integer components in {0,...,N-1}
%  N : defines the maximum value an index can assume (N-1)
%
%   CBVK Toolbox
%   JHMG, PMSB 2016

p = length(inds);
    
for q = p:-1:1
    
    if inds(q) < N-1
        inds(q) = inds(q)+1;
        inds(q+1:end) = inds(q);
        return;
    end;
    
end;

inds = [];