필터 지우기
필터 지우기

Variable for a matrix

조회 수: 4 (최근 30일)
Damith
Damith 2014년 5월 20일
댓글: Damith 2014년 5월 20일
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일
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
Azzi Abdelmalek
Azzi Abdelmalek 2014년 5월 20일
Look at edited answer
Damith
Damith 2014년 5월 20일
Thanks. it worked.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by