Asked by C Zeng
on 29 Apr 2013

Hello, I wonder how can I define an array with a variable, for example,

x_i=an array, where i changes. I do not think Matlab allows such operations. How can I accommodate it? Later on I will use x_i in loops.

Thanks.

*No products are associated with this question.*

Answer by Sean de Wolski
on 29 Apr 2013

Accepted answer

Show 2 older comments

Sean de Wolski
on 29 Apr 2013

Yes, I do. You may find this Webinar helpful:

https://www.mathworks.com/company/events/webinars/wbnr49643.html

Answer by Azzi Abdelmalek
on 29 Apr 2013

k=4 assignin('base',sprintf('x_%d',k),[1 2 3])

Opportunities for recent engineering grads.

## 0 Comments