Define an array with variable

조회 수: 1 (최근 30일)
C Zeng
C Zeng 2013년 4월 29일
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
Sean de Wolski
Sean de Wolski 2013년 4월 29일
Yes, I do. You may find this Webinar helpful:
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에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by