How is this code getting executed?
8 次查看(过去 30 天)
显示 更早的评论
for i=1 : u
x(:,i) = y(:,ij(i-1))-y(:ij(i-2))
end
4 个评论
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
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 Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!