I typed M-! to get the prompt for the shell command, then I typed matlab, and as expected Matlab's command window opened inside emacs, as shown in this figure:

The problem is that when I try typing commands nothing happens. More specifically, what I type appears there (in the figure you can see that I typed "demo"), but pressing return doesn't behave as expected. Instead of running the command, the prompt simply goes to the next line.

I told my friend about this command (M-! matlab), he tried and it worked on his computer (a Mac and Aquamacs, just like me), that is, he can now use Matlab from inside Emacs.

Why doesn't it work on my computer? Do I have some option turned off or something?

Florian, M-x is usually followed by the name of the command, not by RET. When I type M-x RET it says "no command name given". Also, Aquamacs is exclusively built for Mac, so I really don't see why it would call anything from Windows (I see that it is written DOS, but this is there even when the matlab command window is not open - maybe it means something else, but I might be wrong). I am using a matlab mode already, which comes with Aquamacs. It might be the same one as the one you mentioned, but I couldn't even download the one above because it requires CVN or something else I dont have...
–
ViviAug 15 '10 at 10:53

Sorry, it should be C-x, not M-x. As I don't have neither a Mac nor Matlab I can't check if using DOS line ends really causes this problems but it's something to try. On matlab-emacs.sourceforge.net/faq.shtml there's a Matlab script to download the Matlab mode without using CVS if you want to try it.
–
Florian DieschAug 15 '10 at 11:48

When I type "C-x RET p" it asks me for the "coding-system for output from the process". What should I put there?
–
ViviAug 15 '10 at 22:40

The friend I mentioned above gave me his matlab.el file and the commands to put on my .emacs file, and now it all works. I am not sure, but I think what he gave me is what you also mentioned in your answer. Thanks for your help.
–
ViviAug 16 '10 at 8:49