<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">mattyalbrecht@gmail.com</a>>:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">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></div><br>