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++


One thought on “MATLAB → C++

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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s