Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this questionI am developing algorithms for embedded systems and implementing them in c++ code. Prior to testing the c++ code on target, I have to test the algorithms on a PC to make sure the mathematics is correct. To do this, I create a mex file so that I can verify the output in Matlab.
The system with mex files works well, but is quite cumbersome to implement if the purpose is to do a quick test of the algorithms; so does anyone have a recommendation for another tool to plot c/c++ code? I have read something about gnuplot and QWT on this site, but I haven't got good enough a grasp of gnuplot to see whether it is easier to set up than mex files.
There are many plotting packages out there (GNUPlot, XFig, MATLAB, Excel, and so on) each with their own strengths and weaknesses.
But if you have access to MATLAB and are happy with the results why not simply output the data from your program to a .csv file and load it into MATLAB? Then you can plot it using MATLAB without the hassle of implementing .mex files.
For this task any number of plotting utilities like gnuplot, R and a lot more. I think you would want to use a very light weight export routine to export your data as simple as possible in a csv file format for example. Then you could create script to plot the data with any utility.
Personally, I wouldn't use matlab for that. You simply want to create a plot as quickly as possible once you have the data, and powering up matlab and run a script in there would take a lot longer than running a gnuplot script for example. However, if you also want to run filters and mathematical expressions on your data, matlab is great (along with octave of course!)
So there is no real answer to your question, unless you give us a little more insight into what you want to plot. There is in infinite number of plotting tools that is capable to plot the basic stuff.
If you know and like R, then RInside makes it easy to embed R inside your C++ application (at least for the test builds, you would not want that in embedded use).
Among the many example shipping with RInside are some that plot given functions and/or data. I essentially wrote it for the same test case. My blog has a short write-up on embedding this in Qt.
PLplot.
R has fantastic plotting capabilities, and you can use RInside to embed R code in a C++ application.
As others have mentioned, it may be be to separate your plotting code from your application completely. If your requirement is simply that the plotting tool can read a text file full of data and draw a scatterplot or histogram programmatically, then MATLAB or a host of other tools will easily fit the bill.
精彩评论