Wie führt man in Julia eine bedingte Zuweisung in Arrays durch?
In Octave kann ich
octave:1> A = [1 2; 3 4]
A =
1 2
3 4
octave:2> A(A>1) -= 1
A =
1 1
2 3
Aber in Julia funktioniert die entsprechende Syntax nicht.
julia> A = [1 2; 3 4]
2x2 Array{Int64,2}:
1 2
3 4
julia> A[A>1] -= 1
ERROR: `isless` has no method matching isless(::Int64, ::Array{Int64,2})
in > at operators.jl:33
Wie weisen Sie bestimmten Array- oder Matrixelementen in Julia Werte bedingt zu?