0029 <span class="keyword">if</span> nargin&lt;7||isempty(depth); depth=1; <span class="keyword">end</span>
0030 <span class="keyword">if</span> nargin&lt;8||isempty(N); N=2^depth; <span class="keyword">end</span>
0031 
0032 <span class="keyword">if</span> ndims(x)&gt;2 || size(x,2) ==1;
0033     error(<span class="string">'should be 2D matrix'</span>);
0034 <span class="keyword">end</span>
0035 
0036 <span class="keyword">if</span> depth&gt;1;
0037     <span class="comment">% split into 2 clusters</span>
0