I'm trying something like this...
ma=[0.4 0.3; 0.6 0.9;-0.6 15;0.5 0.5] for i1 = 1:size(ma,1)
max=findmax(ma[i1,:])
min=findmin(ma[i1,:])
end
Thanks for helping.
for row=1:size(ma,1)
ma[row, 1] = (ma[row, 1] >= ma[row, 2])
ma[row, 2] = (ma[row, 1] < ma[row, 2])
end
4x2 Array{Float64,2}:
1.0 0.0
0.0 1.0
0.0 1.0
1.0 0.0
The idea is to read each matrix nxm and to replace the max value=1 and min value=0 in case when max and min its the same value, the first receive 1 and the second recive 0.
function change_min_max!{T}(m::Array{T,2})
for row = 1:size(m, 1)
m[row, findmax(m[row, :])[2]] = one(T)
m[row, findmin(m[row, :])[2]] = zero(T)
end
end