For example, I have a matrix A as below:
A = [1, 2, 3; 4, 3, 8; 12, 2, 5; 7 , 4, 9];
So its first column would be like this:
1
4
12
7
How do I find the rows with the first column >6? In Matlab I can do the below:
B = A(A(:,1)>6, :);
How do I do that in Julia?
I tried to get the index by doing
Ind = A[:,1]>6;
and got the below error:
MethodError: no method matching isless(::Int64, ::Vector{Float64})
Closest candidates are:
isless(::AbstractVector{T} where T, ::AbstractVector{T} where T) at abstractarray.jl:1989
isless(::Any, ::Missing) at missing.jl:88
isless(::Missing, ::Any) at missing.jl:87
...
Stacktrace:
[1] <(x::Int64, y::Vector{Float64})
@ Base ./operators.jl:279
[2] >(x::Vector{Float64}, y::Int64)
@ Base ./operators.jl:305
[3] top-level scope
@ In[5]:1
[4] eval
@ ./boot.jl:360 [inlined]
[5] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base ./loading.jl:1116
Many thanks!