Looking through some google results after searching for tips on porting code from matlab to c/c++ I came across the following response on one forum:

Its not a good idea to use .m to C conversion (using mcc) for any commercial application. Codes produce in this way are far from optimized and are slow to run. Most of the time its used for research in Universities where a grad student is too lazy to do it and uses matlab instead. Infact when your code become complex conversion success is limited.

Wow, they sure tell it like it is. To give myself a little credit, it wasn’t laziness, it was a need for quick and easy visualization. Now, between good old gnuplot and the pngwriter c++ libraries, I have that all sorted out.

I’ll post some more details about solving this problem soon. If you have to visualize arrays, like if you want to see what a beam is doing in a nonlinear beam propagation problem, I recommend the pngwriter libs. They make it pretty much a one-liner to generate a PNG image from an array of values. Next up: animations from PNG files.

UPDATE 11-28-07: I have posted part two of Matlab to C++

### Like this:

Like Loading...

*Related*

Pingback: Writing PNGs from C++ « The Daily Photon