Hi,
I have to find mean from Trans1WW to Trans39WW. So, how can i make a variable so that I can include in a for loop.
St1_WW_avg=mean(Trans1WW);
Thanks.

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 5월 20일
편집: Azzi Abdelmalek 2014년 5월 20일

0 개 추천

for k=1:39
eval(sprintf('St1_WW_avg(%d)=mean(Trans%dWW)',k,k));
end
You shouldn't use all these variables, it's better to used one cell array containing all your variables.Look at

댓글 수: 3

Damith
Damith 2014년 5월 20일
Thanks Azzi. I copied and pasted what you written and it does not work. Any idea?
Azzi Abdelmalek
Azzi Abdelmalek 2014년 5월 20일
Look at edited answer
Damith
Damith 2014년 5월 20일
Thanks. it worked.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2014년 5월 20일

댓글:

2014년 5월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by