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

 採用された回答

David Hill
David Hill 2022 年 5 月 23 日

0 投票

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

3 件のコメント

Takim Mustakim
Takim Mustakim 2022 年 5 月 23 日
i using looping with my real script and i want to looking for average for all looping
David Hill
David Hill 2022 年 5 月 23 日
s=0;
for i=1:10
s=s+randi(10);
end
m=s/10;
Takim Mustakim
Takim Mustakim 2022 年 5 月 23 日
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