Whenever two or more persons are charged with an offense in the same information or indictment, and the court is of the opinion that in regard to a particular defendant there is not sufficient evidence to put that person on that person's defense, it shall order that person to be discharged before the evidence is closed that that person may be a witness for that person's codefendant.
N.D.C.C. § 29-21-09