Related: https://github.com/JuliaLang/julia/issues/10618. You should be
able to do A1[1,vec(A1[1,:].!=0)] to get around this.

On Thu, Apr 9, 2015 at 11:12 AM, Changan Liu <lca...@gmail.com> wrote:

>
>
> I meet problems about translating my matrix computation codes from Matlab
> to Julia.
>
> Here is the example :
>
> In Matlab :
>
> A1=[0 2 3;4 0 6;7 8 0];
> B=A1(A1(:,1)~=0,1)
> C=A1(1,A1(1,:)~=0)
>
> We can get :
>
> B =
>
>      4
>      7
>
> C =
>
>      2     3
>
>
> In Julia :
>
> A1=[0 2 3;4 0 6;7 8 0]
> A1[A1[:,1].!= 0,1]
>
> we can get :
>
> 2-element Array{Int64,1}:
>  4
>  7
>
> However, in Julia :
>
> A1[1,A1[1,:].!=0]
>
> It will show the error :
>
> `getindex` has no method matching getindex(::Array{Int64,2}, ::Int64,
> ::BitArray{2})
>
>
> Could anyone help me to point out the problems and how to fix it, please?
> Thank you!
>

Reply via email to