Creating Dynamic variables for future use

10 Ansichten (letzte 30 Tage)
Marco Duarte
Marco Duarte am 12 Sep. 2012
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.

Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 12 Sep. 2012

Weitere Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 12 Sep. 2012
Bearbeitet: Azzi Abdelmalek am 12 Sep. 2012
for k=1:4
v.(sprintf('D%d',k))=rand(k,2)
end
your array are v.D1, v.D2, ...

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by