What does this mean: K12_global(1:3:6,1:3:6)?
조회 수: 3 (최근 30일)
이전 댓글 표시
K12 = K12_global(1:3:6,1:3:6)
I don't know how to interpret that indexing in matrices.
댓글 수: 1
Dyuman Joshi
2023년 12월 4일
편집: Dyuman Joshi
2023년 12월 4일
What exactly do you not know how to interpret?
Did you try searching on this forum for similar questions as mentioned in the 1st point of the help section?
Try dissecting the code into parts and see what each part does.
답변 (2개)
Torsten
2023년 12월 4일
Do you see what happens ?
The new matrix K12 is formed of the elements (1,1),(1+3,1),(1,1+3) and (1+3,1+3) of the original matrix K12_global.
K12_global = rand(9)
K12 = K12_global(1:3:6,1:3:6)
댓글 수: 0
Image Analyst
2023년 12월 4일
Another example
indexes = 1 : 3 : 6
The next index would be 7 since 4 + 3 = 7, but since it was told to stop at 6, the 7 does not get included.
K12_global = reshape(1:49, 7, 7)
K12 = K12_global(1:3:6,1:3:6)
Basically you can see it gets the intersection of the row indexes (1 & 4) with the column indexes (1 & 4).
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!