필터 지우기
필터 지우기

How can i find the number of lines

조회 수: 4 (최근 30일)
Thar
Thar 2014년 12월 13일
답변: Guillaume 2014년 12월 13일
Hi all!!
I have the script:
for h=1:2004
for j=1:numberOfLines; (problem)
K(j,h)=T(j,h)/N(j,1);
end
end
I don't know the number of lines and i need to put in the loop. What can i do?
Thank you!

채택된 답변

Guillaume
Guillaume 2014년 12월 13일
If numberOfLines is supposed to be the numbers of rows in K, T, and N, then have a look at the size function:
numberOfLines = size(T, 1);
However, don't use loops for this sort of calculations. It's simply:
K = bsxfun(@rdivide, T, N);

추가 답변 (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