command in Matlab equivalent to "forall " in fortran
Afficher commentaires plus anciens
Hi Is there any command in matlab that can simpilfy such loop:
for i=1:10 A(i)=i^2 end
as I know in fortran it can be written anr run very fast as FORALL(i=1,10) A(i)=i**2
I hope similar thing can be found in Matlab too.
Réponse acceptée
Plus de réponses (1)
Wayne King
le 24 Mai 2012
A = 1:10;
A = A.^2;
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects 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!