x=dim+1;
<br>
<span class=keyword>for</span>&nbsp;i=1:dim,
<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>for</span>&nbsp;j=i:dim,
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Y(inx,:)=X(i,:).*X(j,:);
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inx=inx+1;
<br>
&nbsp;&nbsp;&nbsp;<span class=keyword>end</span>
<br>
<span class=keyword>end</span>
<br>

<br>
<span class=comment>%&nbsp;deals&nbsp;with&nbsp;labeled&nbsp;data
</span><br>
<span class=keyword>if</span>&nbsp;~isempty(tmp)&nbsp;Y.X&nbsp;=&nbsp;Y;&nbsp;Y.y&nbsp;=