I need to create variables for future use in a loop. For example, for i=1,2,…n, I need to save D1, D2,…,DN, where each Di is a vector with different dimension.
why do you want to do this, you really might want to use a vector with X(1),X(2),...,X(10), they are dynamic in MatLab, so there is nothing to worry about this. And cases are really rare, in which you want to do what you'd like to have...
However, you can do it by using assignin, e.g. like that:
Best Answer