x = j:i:k creates a regularly-spaced vector x using i as the increment between elements. What about x = j:i:k:m? or j:i:k:m:n?
조회 수: 1 (최근 30일)
이전 댓글 표시
I hope I am clear enough. I think it is very odd that this works with how many elements you want to separate with colons. It appears to disregard any elements in between the first and last.
This doesn't appear in the documentation.
댓글 수: 0
채택된 답변
James Tursa
2018년 2월 23일
편집: James Tursa
2018년 2월 23일
This is simply left-to-right operator evaluation.
j:i:k:m:n
evaluates as
(j:i:k):m:n
And, as stated in the doc:
"If you specify nonscalar arrays, then MATLAB interprets j:i:k as j(1):i(1):k(1)."
So your syntax, although probably confusing, is covered in the doc and simply uses the first element of the created vectors at each intermediate result when generating the next intermediate result.
EDITED to delete comments that didn't apply
댓글 수: 2
James Tursa
2018년 2월 23일
편집: James Tursa
2018년 2월 23일
You're right. I was using 1:2:3:4 as one of the test cases for my spot testing, but that doesn't match your five element pattern so that part of my answer didn't apply. I have edited my answer.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!