Something I learned through this exercise is that Fortran 90 apparently provides
array programming features as in the following line of code:
out=sum(abs(in_1(1,:))**dim)**(1/dble(dim))
which computes the $L_{dim}$ norm of the $1 \times n$ array in_1,
without the use of any loop.
1
24 Jan 2012
matlab2fmex
matlab2fmex.m is a small translator which aims to convert numerical M-files to Fortran90 mex.
I find this a very limited tool;
it is by far not robust and the 'documentation'
is not around the right priorities.
Admittedly, it's a tough job to translate between
Matlab = an array programming language with zillions of readily available 'library' functions
to
Fortran = a strong typed language, whose even later flavours may still be a bit 'deficient' as to handling
and declaring arrays; not to mention that one needs the Diogenes lantern to look around for
zillions of libraries, scattered around the Net (i.e NOT readily available !), that barely implement
a subset of Matlab's 'core' vector-matrix math
As said, I find the approach taken by matlab2fmex as utmostly unappealing in its:
* all-or-nothing approach: you won't get a single .F90 line out unless you:
a) think small, and
b) are ready to go back
to the drawing board of your ORIGINAL Matlab code to make it compatible with the tons of matlab2fmex's
(sometimes very unintuitive) rigid constraints
* that a long list of Matlab-inspired operator-primitives will accompany every teeny bit of user function;
instead of having directed the user to a matlab2fmex 'standard' .F90 module, from which to pick primitives that are ACTUALLY NEEDED.
* that it ambitions to go all the way to actual mex compilation:
a) this is a non-sequitur (see above)
b) it loads the translations with yet another layer (the mex one) of human-unintelligible .F90 code
* All this is made 'turn key' for a beginner in both Matlab and Fortran?!
No kidding guys!
===============
Overall: yet another poor semi-automatic translator
For all the people who have noted about cprintf's issues with R2011b, the new version that was just uploaded fixes those problems, as well as the issue of the space (on R2011b only)
You might find that changing the fprintf command on line 164 to use the standard output instead of standard error may solve your problem with the text colour
i.e. use
fprintf(1,format,varargin{:})
inplace of
fprintf(2,format,varargin{:})
Comment only