指数阵列多个范围

做朱莉娅阵列的支持索引与多个范围,如以下指数阵列多个范围

dat = Array(1:10) 

# trying to get dat[[1:3, 6:8]] to result in

dat[[1,2,3,6,7,8]]

寻找的东西,就好像将R相当于dat[c(1:3, 6:8)]

回答:

中的R版本直接等同是

v = 1:10 

v[ [1:3; 6:8] ]

因为;是连接运算符:

julia> [1:3; 6:8] 

6-element Array{Int64,1}:

1

2

3

6

7

8

你也可能想看看在Iterators.jl包chain:https://github.com/JuliaLang/Iterators.jl

以上是 指数阵列多个范围 的全部内容, 来源链接: utcz.com/qa/257900.html

回到顶部