format short
datasave=[];
for i=1:10
a=randi(10);
datasave=[i a];
end
display(a)
how to looking for average a for all loop i ??

 Réponse acceptée

David Hill
David Hill le 23 Mai 2022

0 votes

No loop needed.
average_a=mean(randi(10,1,10))

3 commentaires

Takim Mustakim
Takim Mustakim le 23 Mai 2022
i using looping with my real script and i want to looking for average for all looping
s=0;
for i=1:10
s=s+randi(10);
end
m=s/10;
Takim Mustakim
Takim Mustakim le 23 Mai 2022
thank you bro

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Produits

Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by