I'm using scilab. Basically i want the same as this guy Create 'n' matrices in a loop or this guy http://www.mit.edu/~pwb/cssm/matlab-faq_4.html#evalcell
The answer is not working in scilab, and I can not manage it to do the same in scilab. Can someone help me.
If I get your intention right, you want to use dynamic variable names (=variable names are not hardcoded but generated during execution). Is that correct?
As others already pointed out in the linked posts (and at many other places, e.g. here), in general it is not advisable to do this. It's better to use vectors or matrices (2D or 3D), if your variables have the same size and type, e.g. if
Better way:
This way you can store the variables in a more efficient matrix form, which executes faster (loops are slow!) and generally more flexible as independent variables (you can define a certain subset of them, and execute matrix operations, etc.)
However if you really want to do it, use
execstr
:If variable names are only important when you display the results, you can make the indices to appear as part of the variable name, e.g.: