How is this code getting executed?

조회 수: 8 (최근 30일)
Varun Rahul Lale
Varun Rahul Lale 2021년 10월 1일
댓글: Walter Roberson 2021년 10월 1일
for i=1 : u
x(:,i) = y(:,ij(i-1))-y(:ij(i-2))
end
  댓글 수: 4
DGM
DGM 2021년 10월 1일
It's unclear what operations you're trying to do. Y is 10x7 and ij is 14x2. You want the result of yi-yj, neither of which are defined. Is this supposed to mean Y*ij(:,1) - Y*ij(:,2)? If so, the array size mismatch means that this won't work either as a matrix multiplication or as an elementwise multiplication. How does the loop example correspond to the problem statement?
Walter Roberson
Walter Roberson 2021년 10월 1일
for i=1 : u
x(:,i) = y(:,ij(i-1))-y(:,ij(i-2))
end
You were missing a comma

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

답변 (0개)

카테고리

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

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by