ולא יכל יוסף להתאפק לכל הנצבים עליו ויקרא הוציאו כל איש מעלי ולא עמד איש אתו בהתודע יוסף אל אחיו
Rashi explains that he did this to save his brothers from humiliation.
לא היה יכול לסבול שיהיו מצרים נצבים עליו ושומעין שאחיו מתביישין בהודעו להם
Reb Moshe, brought in Rabbi Fishelis' Kol Rom, explains that for mussar to be effective, it is important that the person feel that what he did was not who he really is. He needs to feel that what he did was a momentary weakness and error, but that he is really a better person who would not do such a thing if he were only more disciplined or thoughtful. If Yosef were to publicly say what the brothers had done, it would leave the impression that this is who they are, and their only teshuva would be to completely remake themselves. Instead, Yosef had everyone leave the room, so that the brothers would realize that Yosef himself felt what they had done was an embarrassing lapse, an exception to there usual refined behavior, and it would be wrong to expose that momentary lapse. (This presentation is my son, Reb Mordechai's, explanation of the very short version in the Kol Rom.)