Skip to content

Commit dba2a7a

Browse files
PaulSoderlindjohanmon
authored andcommitted
add selectdim(A, 2, 3:4) example (JuliaLang#40456)
This adds a `selectdim(A, 2, 3:4)` example to illustrate that several indices can be used (as this is not entirely clear in the text). Based on a suggestion in https://discourse.julialang.org/t/pick-rows-from-array-ndims-not-known-in-advance/59033/6
1 parent 8c85689 commit dba2a7a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

base/abstractarraymath.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ julia> selectdim(A, 2, 3)
117117
2-element view(::Matrix{Int64}, :, 3) with eltype Int64:
118118
3
119119
7
120+
121+
julia> selectdim(A, 2, 3:4)
122+
2×2 view(::Matrix{Int64}, :, 3:4) with eltype Int64:
123+
3 4
124+
7 8
120125
```
121126
"""
122127
@inline selectdim(A::AbstractArray, d::Integer, i) = _selectdim(A, d, i, _setindex(i, d, map(Slice, axes(A))...))

0 commit comments

Comments
 (0)