"Malcolm in the Middle" star Frankie Muniz suffered a mini-stroke last week -- and sources tell TMZ, doctors are still stumped about the cause.

Sources close to Frankie tell TMZ, the 26-year-old was taken to an Arizona ER on Friday when friends noticed he was "acting really weird" -- having trouble speaking and understanding words -- and they got freaked out.

Doctors told Frankie he had suffered a "mini-stroke" though they didn't know what caused it. We're told Frankie's still awaiting test results.