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

질문:

2022년 5월 23일

댓글:

2022년 5월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by