In Matlab I have vector and vector of ranges.
a = [10., 9., 8., 7., 6., 5., 4., 3., 2., 1.]
dr = [1:2, 4:7]
If I want a new vector from ranges I will call.
mo = a(dr)
mo = 10 9 7 6 5 4
In Julia I started with the function of map()
and I got this.
jHelp = map(x -> a[x], dr)
JHelp = Array{Array{Float64,1},1}[[10., 9.], [7., 6., 5., 4.]]
After much effort , I worked on the same result as Matlab with the help of mapreduce()
.
.
jo = mapreduce(x -> a[x], vcat, dr)
jo = [10., 9., 7., 6., 5., 4.]
There is some simpler alternative or this is the best possible solution?
Thanks.