Re: C to MATLAB from scratch.Where to start?




CY skrev:

Both Michael & Steve have very meaningfully have commented that the
conversion per se is not worth a while.
My question is about the reverse conversion from .m to C/C++, does
the same theory apply about better code in C from scratch rather than
the conversion or would this be an effective way to use the mcc
compiler?

Start from scratch.

Matlab doesn't handle trivial program elemnts like for loops very well.

Some 70% of the time spent learning to program matlab is spent on
making matlab do trivial stuff in a reasonable amount of time.

There are a number of reasons for that, all of which have to do
with how the matlab code expresses the algorithm. Since the
m code to some extent is ambiguious, the automatic C compiler
can not resolve the ambiguities, which in turn means it needs to
introduce the same precautions that the matlab interpreter does.

The end effect is that the compiled C code at best is marginally
faster than interpreted m code.

So get hold of some good numerical libraries, and start from
scratch with your C program if run-time is a concern.

Rune

.



Relevant Pages


Loading