Define an array with variable

1 次查看(过去 30 天)
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.

采纳的回答

Sean de Wolski
Sean de Wolski 2013-4-29
  5 个评论
C Zeng
C Zeng 2013-4-30
Oh, great! Thanks so much!

请先登录,再进行评论。

更多回答(1 个)

Azzi Abdelmalek
Azzi Abdelmalek 2013-4-29
k=4
assignin('base',sprintf('x_%d',k),[1 2 3])

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by