Thanks, works well.<br><br><div><span class="gmail_quote">On 29/02/2008, <b class="gmail_sendername">Eric Dubois</b> <<a href="mailto:grocer.toolbox@gmail.com">grocer.toolbox@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>Do :</div>
<div> </div>
<div>for i=1:n</div>
<div>    execstr('x'+string(i)+'='+string(i))</div>
<div>end<br> </div>
<div>Or more efficiently (but less general) :</div>
<div> </div>
<div>execstr('x'+string([1:n])+'='+string([1:n])</div>
<div> </div>
<div>Eric.</div>
<div><br> </div>
<div><span class="gmail_quote">2008/2/29, Matthew Albrecht <<a href="mailto:mattyalbrecht@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">mattyalbrecht@gmail.com</a>>:</span><div><span class="e" id="q_118644ba448317c8_1">
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">I would like to keep track of the output of a for loop, so that each output is assigned sequentially to a new variable from 'x1' to 'xn'.<br>

In its most simplest form, I would like to be able to do this:<br><br>for i=1:n<br>x=i<br>end<br>
<div style="margin-left: 40px;">x1=1<br> </div>
<div style="margin-left: 40px;">x2=2<br> </div>
<div style="margin-left: 40px;">....<br> </div>
<div style="margin-left: 40px;">xn=n<br> </div><br>Where currently it outputs<br>
<div style="margin-left: 40px;">x=1<br> </div>
<div style="margin-left: 40px;">x=2<br> </div>
<div style="margin-left: 40px;">...<br> </div>
<div style="margin-left: 40px;">x=n<br><br> </div>Thanks<br>Matt<br></blockquote></span></div></div><br>
</blockquote></div><br>