[英]How do I plot the output from a C++ Win32 console app?
I have a small Win32 console application which is essentially a test harness. 我有一个小的Win32控制台应用程序,它本质上是一个测试工具。 I read data in, do some processing on it and currently just output some of the numbers to the console.
我读入数据,对其进行一些处理,当前仅将一些数字输出到控制台。 This isn't a huge problem - I can get an idea of what the data looks like, but it would be much easier to analyse if there was a way of getting that information into a graph for each run of the software.
这不是一个大问题-我可以大致了解数据的样子,但是如果有一种方法可以针对每次运行的软件将这些信息转换成图形,则分析起来会容易得多。
I've been getting to grips with GNUPlot recently, but can't work out a simple way to get the data sent to it. 我最近一直在处理GNUPlot,但是无法找到一种简单的方法来获取发送给它的数据。 Has anyone tried this?
有人尝试过吗? ..or is there another graphing application I should try?
..还是我应该尝试另一个绘图应用程序?
Excel and OO Calc are great tools and I've loaded .csv data into them for graphing data plenty of times myself. Excel和OO Calc是出色的工具,我已经将.csv数据加载到其中,以便自己多次绘制图形数据。 I was, however, hoping for a way to dynamically pipe data into a graphing application to avoid having to close/reopen excel and plot a graph each time I want to look at some data.
但是,我希望能有一种方法将数据动态地传递到绘图应用程序中,以避免每次我要查看某些数据时都必须关闭/重新打开excel并绘制图形。
I think you can pipe data into GNUPlot (which is why I mentioned it) but the details of how to do so are rather scant. 我认为您可以将数据通过管道传输到GNUPlot(这就是我提到它的原因),但是这样做的细节却很少。
A simple approach is to wtite the data out as CSV and then import it into a spreadsheet like Excel or OpenOffice to do the graph drawing. 一种简单的方法是将数据修改为CSV格式,然后将其导入Excel或OpenOffice等电子表格中以进行图形绘制。
Edit: Following your question, I got interested in GNUPlot myself - this is the simplest description of using it from the command line that I found: http://www.goldb.org/goldblog/CommentView,guid,f378e279-eaa5-4d85-b7d2-0339a7c72864.aspx 编辑:按照您的问题,我自己对GNUPlot感兴趣-这是从发现的命令行中使用它的最简单的描述: http : //www.goldb.org/goldblog/CommentView,guid,f378e279-eaa5-4d85 -b7d2-0339a7c72864.aspx
Never underestimate the power of Excel and a .csv data dump. 永远不要低估Excel和.csv数据转储的功能。
Writing data to a .csv file form C++ is not very difficult and there's lots of articles out there regarding the subject, for example: here , or just google. 用C ++将数据写入.csv文件不是很困难,并且有很多关于该主题的文章,例如: here或google。
Excel can easily load .csv's and then you can just use that to plot whatever graphs you require. Excel可以轻松加载.csv,然后您就可以使用它来绘制所需的任何图形。 THis is particularly useful if you just want a quick visual sanity check of results etc.
如果您只想对结果进行快速的视觉检查,这特别有用。
You don't really need to touch VBA to do this 您实际上不需要触摸VBA即可执行此操作
In Excel you can set up a Data Connection to a file, it supports many files type but CSV does work fine. 在Excel中,您可以设置文件的数据连接,它支持许多文件类型,但是CSV确实可以正常工作。
the chart will now update automatically 图表现在将自动更新
this is Excel 2007 - but think older version had this and I think OO can do it to. 这是Excel 2007-但认为较旧的版本具有此功能,我认为OO可以做到。
I just found an example of piping data into gnuplot on Cardiff University's website. 我刚刚在加的夫大学的网站上找到了将数据传递到gnuplot的示例 。 Not tried it yet, but it looks promising!
尚未尝试过,但看起来很有希望!
[edit] ..and another which includes some notes for windows . [edit] ..和另一个,其中包含有关Windows的一些注释 。
Excel is completely script-able. Excel完全可以编写脚本。 Use the macro recorder to figure out the steps.
使用宏记录器找出步骤。 Create the chart in its own sheet.
在自己的工作表中创建图表。 Then save the chart using the GIF filter.
然后使用GIF过滤器保存图表。
The actual import is something like: 实际的导入类似于:
ActiveChart.Export FileName:=something_dot_gif, FilterName:="GIF" ActiveChart.Export FileName:= something_dot_gif,FilterName:=“ GIF”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.