I'm not sure I understand, but how's this?
julia> s = [1,2,5,7,3,3]
6-element Array{Int64,1}:
1
2
5
7
3
3
julia> x = 4
4
julia> find(s.<x)
4-element Array{Int64,1}:
1
2
5
6
On Thursday, November 26, 2015 at 2:52:50 PM UTC+8, Aleksandr Mikheev wrote:
>
> Hi all,
>
> So imagine I have an array. For example:
>
> s = [1 2 5 7 3 3]
>
>
> Also, I have x = 4. And I would like to have an array of indexes
> of elements s that satisfy:
>
> s .< x
>
>
> In Fortran or MATLAB I would do something like this:
>
> indx = 1:1:size(s) (or length(s) in MATLAB)
>
> And then:
>
> indx = pack(indx,s>x)
>
>
> or
>
> indx=indx(s < x)
>
>
> In Julia I tried something like:
>
> indx = indx.*(s .< x)
>
>
> But I had a matrix in output for some reason. So what is the easiest
> solution in this situation?
>
>