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 ??

 采纳的回答

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

3 个评论

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;
thank you bro

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Loops and Conditional Statements 的更多信息

产品

版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by