Buenos noches OP,
I visited both cities May 2005 and, for me, Madrid wins hands down.
Barcelona has more Mediterranean feeling to it -- probably because it is on the Mediterranean.

Calamari is to die for. The biggest rings I've seen in my life. There is decent architecture there.
Madrid has a wilder side to it. And that's all I will say in a public form. (cough cough.) The bars don't get crowded until midnight-1 am -- so I hope your class doesn't start at 8 am.
I am sure you have fun regardless of the city.
David