简体   繁体   English

在C ++中将实数和调试数据流式传输到磁盘

[英]Streaming Real and Debug Data To Disk in C++

What is a flexible way to stream data to disk in a c++ program in Windows? 在Windows中的c ++程序中,将数据流式传输到磁盘的灵活方法是什么?

I am looking to create a flexible stream of data that may contain arbitrary data (say time, average, a flag if reset, etc) to disk for later analysis. 我希望创建一个灵活的数据流,可以包含任意数据(如时间,平均值,重置标志等)到磁盘以供以后分析。 Data may come in at non-uniform, irregular intervals. 数据可能以不均匀,不规则的间隔进入。 Ideally this stream would have minimal overhead and be easily readable in something like MATLAB so I could easily analyze events and data. 理想情况下,此流将具有最小的开销,并且可以在MATLAB之类的内容中轻松读取,因此我可以轻松地分析事件和数据。

I'm thinking of a binary file with a header file describing types of packets followed by a wild dump of data tagged with . 我正在考虑一个带有头文件的二进制文件,该头文件描述了数据包的类型,然后是标记有的数据的狂放转储。 I'm considering a lean, custom format but would also be interested in something like HDF5 . 我正在考虑一种精简的自定义格式,但也会对像HDF5这样的东西感兴趣。

It is probably better to use an existing file format rather than a custom one. 使用现有文件格式而不是自定义文件格式可能更好。 First you don't reinvent the wheel, second you will benefit from a well tested and optimized library. 首先,您不要重新发明轮子,其次,您将受益于经过良好测试和优化的库。

HFD5 seems like a good bet. HFD5似乎是一个不错的选择。 It is fast and reliable, and easy to read from Matlab. 它快速可靠,易于从Matlab读取。 It has some overhead but it is to allow great flexibility and compatibility. 它有一些开销,但它允许很大的灵活性和兼容性。

这个要求听起来像一个“数据库”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM