Is it possible generate and handle generated variable names?

6 vues (au cours des 30 derniers jours)
Mr M.
Mr M. le 19 Mai 2015
For example is it possible to make a for cycle which generates the following variables? v1 = 1; v2 = 2; v3 = 3;

Réponses (2)

Star Strider
Star Strider le 19 Mai 2015
It is, but it is considered to be very bad programming practice.
It is better to create them as an array instead:
v(1) = 1;
v(2) = 2;
v(3) = 3;
This has the same effect, but is much more efficient and much easier to work with.

Walter Roberson
Walter Roberson le 19 Mai 2015

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by