Creating Dynamic variables for future use

조회 수: 11 (최근 30일)
Marco Duarte
Marco Duarte 2012년 9월 12일
Hi.
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.
Can anybody help me?
Marco.

채택된 답변

Sean de Wolski
Sean de Wolski 2012년 9월 12일

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2012년 9월 12일
편집: Azzi Abdelmalek 2012년 9월 12일
for k=1:4
v.(sprintf('D%d',k))=rand(k,2)
end
your array are v.D1, v.D2, ...

카테고리

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