average for all looping

1 view (last 30 days)
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 ??

Accepted Answer

David Hill
David Hill on 23 May 2022
No loop needed.
average_a=mean(randi(10,1,10))
  3 Comments
Takim Mustakim
Takim Mustakim on 23 May 2022
thank you bro

Sign in to comment.

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!