Dear Scilab users,<br><br>I wonder how one can create variables or graphical handles programmatically and assign values to them at the same time. For instance, consider the following attempted code where nstates 'sub-plots' should be created within a figure (please, note that I don't want to use the subplot function for some other reason). This syntax is obviously wrong, according to the Scilab error message, but I do not know how to fix that. Any help would be greatly appreciated.<br>
<br>Sebastien<br><br><br>///////////////////<br>figure()<br><br>nstates=6;<br>ndim= ceil(sqrt(nstates));<br>multi=pmodulo((1:nstates)-1,ndim);<br>margin=0.05;<br><br>for (j=1:nstates)<br> eval('g' + string(j) + '=newaxes()')<br>
eval('g' + string(j) + '.axes_bounds=[' + string(multi/ndim) + ',' +...<br> string(marg + multi*(1-marg)/ndim) + ',' +...<br> string(1/dim) + ',' +...<br> string((1-marg)/ndim) + ']'); <br>
end<br><br>/////////////// Scilab error message<br>%h=g1=newaxes();<br> ! <br>at line 3 of function %eval called by : <br>line 17 of function eval called by : <br>
eval('g' + string(j) + '=newaxes();')<br>