필터 지우기
필터 지우기

what is the meaning of these two lines?

조회 수: 1 (최근 30일)
Saf el
Saf el 2017년 11월 30일
댓글: Saf el 2017년 11월 30일
siz = size(P);
for i = 1:siz(2)
with P is a 2*k matrix, P =[p1 .....pk] I want to understand what siz(2) means in the for loop. Thanks!!

채택된 답변

Geoff Hayes
Geoff Hayes 2017년 11월 30일
Saf - the size function returns the dimensions of the input parameter. In your case, if P is a 2x12 matrix so size(P) is
siz = size(P);
siz =
[ 2 12 ]
The for loop then iterates from 1 to siz(2) which (in this case) will be 12. So the loop will iterate over the number of columns in P.
  댓글 수: 3
Saf el
Saf el 2017년 11월 30일
I understand it now. Thank you Geoff!
Saf el
Saf el 2017년 11월 30일
Fangjun- yes, it works. Thank you for your help!

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

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