variable=variable+i written something like variable+=i?
Afficher commentaires plus anciens
I have an array with a long calculation as index and want to add 1*(the imaginary unit) to that element in the array and I would like to do that without writing it twice, how do I do that?
Réponses (2)
Guillaume
le 8 Oct 2014
0 votes
There's nothing equivalent to the operator += in matlab. There is no way round to writing the variable name twice, I'm afraid.
Thorsten
le 8 Oct 2014
You can us something like this so that you don't have to do the very long index computation twice
ind = % very long computation here
array(ind) = array(ind) + sqrt(-1);
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!