Diagnosis combined with treatment in closed-loop systems or methods