oof, embarrasing error from my part. i misunderstood the meaning of the start argument on findnext
.the function that should do what op wants is along the lines of:
function findmax_view(x,b)
c = argmax(view(x,b))
i0 = findfirst(identity,b) #find the first value
for _ in 1:c-1 #findnext iteratively c-1 times
i0 = findnext(identity,b,i0+1)
end
return i0
end