私はJuliaでブール比較について簡単な質問があります。次のMatlabコードをJuliaにどのように変換しますか?Julia:配列との論理比較
Matlabの:
% create parameters
o = -3;
mat = [65 -4; 65 -3; 65 -2]
% determine which rows of matrix have column 2 less than o AND column 1 equal to 65.
result = (o < mat(:,2) & mat(:,1) == 65)
私はジュリアに次のように試してみた:
# create parameters
o = -3
mat = zeros(3,2)
mat[:,1] = 65
mat[1,2] = -4
mat[2,2] = -3
mat[3,2] = -2
mat
# attempt to create desired result
o .< mat[:,2] # this part works
mat[:,1] .== 65 # this part works
test = (o .< mat[:,2] && mat[:,1] .== 65) # doesn't work
test = (o .< mat[:,2] .& mat[:,1] .== 65) # doesn't work
test = (o .< mat[:,2] & mat[:,1] .== 65) # doesn't work