Print for loop iterations with their specific label

5 visualizzazioni (ultimi 30 giorni)
How can I get a for loop to print the specific iteration number it is on? For example I'm using a for loop to print the Fourier series coefficient, which I can do no problem, but rather than each print out be "an=", "an=", "an=", etc, how can I make it that each label is printing and incrementing, such as "a1=", "a2=", "a3=", etc. I apologize if the language of this request is confusing but hopefully the example I used is clear enough.

Risposte (1)

madhan ravi
madhan ravi il 13 Dic 2018
Don't think of naming variables dynamically but if it's for your label then sprintf()(lookup in the documentation) should do it.

Categorie

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

Community Treasure Hunt

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

Start Hunting!

Translated by