Azzera filtri
Azzera filtri

project question

1 visualizzazione (ultimi 30 giorni)
teesside university
teesside university il 8 Mar 2012
I'm using embedded matlab function for my project. How to initialize the parameter just once at the beginning? some sort like this: kp = 0 (initialize once only) kp=kp+1 (the value of kp is updated after every loop running)

Risposte (1)

Grufff
Grufff il 8 Mar 2012
I'm not sure if I've understood correctly what you want to do, because you've essentially answered your own question, but...
you can define any variables you like in a script or function, so
kp=0
will work fine as long as it's not within a loop. Then, if you wish to increment it each time through a process or iteration just include the incrementing statement in the loop. You can also nest loops if needed.
Look up commands "for" and "while" in Matlab help to read about loops and see some examples.

Categorie

Scopri di più su Multidimensional Arrays 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