Is this easy enough?

julia> x = reshape(1:16, 4, 4)
4x4 Array{Int64,2}:
 1  5   9  13
 2  6  10  14
 3  7  11  15
 4  8  12  16

julia> a = x[1,:]
1x4 Array{Int64,2}:
 1  5  9  13

julia> [a == x[k,:] for k = 1:size(x,1)]
4-element Array{Any,1}:
  true
 false
 false
 false

julia> any([a == x[k,:] for k = 1:size(x,1)])
true

julia> find([a == x[k,:] for k = 1:size(x,1)])
1-element Array{Int64,1}:
 1


Den torsdagen den 7:e augusti 2014 kl. 06:09:23 UTC+2 skrev K leo:
>
> julia> x 
> 4x4 Array{Int64,2}: 
>   1  5   9  13 
>   2  6  10  14 
>   3  7  11  15 
>   4  8  12  16 
>
> julia> in(x[1,:], x) 
> false 
>
> julia> x[1,:] 
> 1x4 Array{Int64,2}: 
>   1  5  9  13 
>
> How can I check if x[1,:] is in x easily?  And with the row index in x? 
>

Reply via email to