Azzera filtri
Azzera filtri

To create numbered variables from a for loop

10 visualizzazioni (ultimi 30 giorni)
Hi,
Is there a way to generate numbered variables by a for loop ?
For example, if I have:
for i = 1:4
How can I generate the variables:
A_1
A_2
A_3
A_4
(named automatically by for loop)

Risposta accettata

bym
bym il 21 Nov 2012
Don't
Please see this FAQ
  2 Commenti
Walter Roberson
Walter Roberson il 4 Lug 2018
Anant Mane comments to bym,
'Accepted Answer' is not an answer at all.
Walter Roberson
Walter Roberson il 4 Lug 2018
Anant Mane:
Not creating numbered variables is the recommended approach from all of the main volunteers here, most of whom have extensive MATLAB experience.
The FAQ that bym linked to has explanations of why it is not a good idea, and gives several alternatives, and also gives a method of creating such variables for those who feel that they really must.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by