">%  thresh: threshold to discard PCs (default: 10^-6)</span>
0009 
0010 <span class="keyword">if</span> nargin&lt;3||isempty(thresh); thresh=0; <span class="keyword">end</span>
0011 <span class="keyword">if</span> nargin&lt;2; w=[]; <span class="keyword">end</span>
0012 
0013 <span class="keyword">if</span> ~isempty(w); error(<span class="string">'weights not yet implemented'</span>); <span class="keyword">end</span>
0014 
0015 <span class="keyword">if</span> ndims(x)&gt;2;
0016     [m,n,o]=size(x);
0017  