5) I want to write MEX files, why should I write in FORTRAN instead of C or C++?

Have you ever heard of the crusades? They were pretty minor skirmishes compared to the wars fought between Fortran and C. Fortran and C both have their strengths when it comes to numerical code. I am not a computer scientist, I don’t know C, I am speaking from impressions gleaned from others who do code C and Fortran.

Matlab is very Fortran-like. I think, though I don’t know this for a fact, that Matlab was written so that students & others wouldn’t need to write as much Fortran. Because of this, if you don’t already know C or Fortran, but need to learn a lower level (faster) language than Matlab, Fortran is a very easy transition. This is how I learned Fortran, in fact. Because the syntax is so similar, my MEX files all are written as .m files and debugged. Then I copy/paste them into a Fortran file, comment out all of the Matlab code, and start translating the Matlab into Fortran, line-by-line. Finally, and here I am really out on a limb, for programmers who are not computer science specialists, Fortran is probably faster. C is generally much more powerful than Fortran — it was originally created for writing operating systems — and therefore is a more flexible language. This flexibility can impair a compiler’s ability to generate fast code. Fortran, on the other hand, was written for numerical analysis. It was and is written with specific attention to the ability of compilers to generate fast code.

Ergo, write your MEX file in Fortran.