Read large dat file and get the necessary data
이전 댓글 표시
I have a rather large dat file (~1.5 Gb) which I import into Matlab. It contains a text and value as below.
{
"os": [
{
"utc": "2021-09-14 02:54:56",
"lat": 35.59538,
"lon": 129.574246,
"hdt": 295.9,
"rot": -2.1,
"sog": 1.0,
"cog": 335.5,
"rudder_order_stbd": null,
"rudder_order_port": null,
"rudder_stbd": 0.0,
"rudder_port": 0.0,
"rpm_stbd": 0.0,
"rpm_port": 0.0,
"stw_long": 0.87,
"stw_trans": "NaN",
"stw_long_stern": "NaN",
"stw_trans_stern": "NaN",
"stw_speed": null,
"wind_dir": 134.0,
"wind_speed": 5.5,
"current_dir": null,
"current_speed": null
},
{
"utc": "2021-09-14 02:54:58",
"lat": 35.595385,
"lon": 129.574233,
"hdt": 295.9,
"rot": -1.3,
"sog": 0.9,
"cog": 331.1,
"rudder_order_stbd": null,
"rudder_order_port": null,
"rudder_stbd": 0.0,
"rudder_port": 0.0,
"rpm_stbd": 0.0,
"rpm_port": 0.0,
"stw_long": 0.87,
"stw_trans": "NaN",
"stw_long_stern": "NaN",
"stw_trans_stern": "NaN",
"stw_speed": null,
"wind_dir": 141.0,
"wind_speed": 5.3,
and
"ts": [
[
{
"header": "VDM",
"msg_type": 1,
"mmsi": 440196110,
"navi_status": 0,
"time_stamp": 54,
"lat": 35.515383,
"lon": 129.386093,
"hdt": 2,
"rot_raw": 0,
"rot": "0",
"cog": 327.6,
"sog": 0.0
},
{
"header": "VDM",
"msg_type": 1,
"mmsi": 355924000,
"navi_status": 0,
"time_stamp": 56,
"lat": 35.345183,
"lon": 129.467416,
"hdt": 221,
"rot_raw": -127,
"rot": "-708",
"cog": 225.0,
"sog": 2.6
}
I want to export the value for each parameter as the matrix in .DAT file. But as you can guess, for a file this size it takes forever to run through. Is there a better way of accomplishing this and export the data?
Many thanks!
댓글 수: 2
Stephen23
2022년 2월 16일
A representative data file can be shortened, but must include sufficient data so that we can understand the file format.
Jan
2022년 2월 16일
Yes, an 1.5 GB JSON file in text mode will take some time for reading.
It is not clear, what "export each matrix in .DAT" file means. Which matrices do you mean?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
