我在文本文档中有数据,其中一些行具有比其他行更多的参数(没有特定顺序)。数据中有大约90个参数。
e.g 前100行有4个参数,如:
{ “A”:1.675, “B”:21.8, “C”:34, “d”:63}
现在150 - 200行有6个参数,如:
{ “A”:1.675, “B”:21.8, “C”:34, “d”:63, “E”:34, “F”:87}
然后第200-250行再次像前100个人一样 然后在350-400行之间的某个地方再次有6个参数,但格式如下:
{ “A”:1.675, “B”:21.8, “C”:34, “F” 63, “E”:34, “d”:87}
我希望处理数据并显示如下:
这是数据的外观:
{"total_gas":0.0,"hook_load":9.7,"mud_flow_in":0.0,"pump_spm_total":0.0,"svy_azimuth":171.8872648725456,"pit_volume_8":0.0,"gain_loss":0.3,"pit_volume_7":0.0,"pit_volume_6":0.0,"block_height":114.9,"pit_volume_5":0.0,"pit_volume_4":0.0,"pit_volume_3":0.0,"pit_volume_2":0.0,"drill_hardness":0.0,"pit_volume_1":0.0,"strks_pump_3":0.0,"weight_on_bit":0.0,"strks_pump_1":0.0,"strks_pump_2":0.0,"standpipe_pressure":0.0,"mud_flow_out":0.0,"state":"InSlips","svy_depth":0.0,"mud_volume":484.1,"rotary_rpm":0.0,"strks_total":0.0,"hole_depth":0.0,"pump_spm_3":0.0,"pump_spm_2":0.0,"rop_fast":0.0,"pump_spm_1":0.0,"mud_temp_in":0.0,"svy_inclination":229.18301983006077,"mud_temp_out":0.0,"rotary_torque":0.006,"gamma_ray":0.0,"diff_press":0.0,"bit_depth":0.0,"rop_average":0.0}~{}
我希望程序读取每一行并将其放在适当的列中。我只知道java,excel和matlab。
答案 0 :(得分:0)
您的文件似乎是以http://codepen.io/bennygill/pen/bZkJyV格式编写的(有关详情,请参阅json)。
您可以使用matlab的json
info:
out
您应该让所有数据都是结构{{1}},其字段对应于列名。