Anonymous Functions for updating arrays.
Afficher commentaires plus anciens
I use many anonymous functions for updating elements within arrays. However generally this requires me to write this kind of thing:
Anew = A;
Anew(i) = anon_f(A,i);
However I feel it should be possible to redefine the function so that all I need is:
Anew = anon_f2(A,i);
Of course, I could always just use child functions instead... An example function:
f = @(state,i)(2*ceil(rem(sum(state(:,i).^3),1)) - 1);
Réponse acceptée
Plus de réponses (0)
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!