LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read the data from the txt file and store them in two-dimensional array using CVI

Hi !

The following is the data stored in my txt file.

04-12-2011  14:27:13     外部交流电压 220, 主回路电压 27.368,主回路电流 0.088, 工作电池箱 1,工作电池组 0, 工作状态 4
04-12-2011  14:27:23     外部交流电压 219, 主回路电压 27.369,主回路电流 0.1, 工作电池箱 1,工作电池组 0, 工作状态 4
04-12-2011  14:27:33     外部交流电压 220, 主回路电压 27.35,主回路电流 0.06, 工作电池箱 1,工作电池组 0, 工作状态 4
04-12-2011  14:27:43     外部交流电压 219, 主回路电压 27.35,主回路电流 0.094, 工作电池箱 1,工作电池组 0, 工作状态 4
04-12-2011  14:27:53     外部交流电压 219, 主回路电压 27.355,主回路电流 0.073, 工作电池箱 1,工作电池组 0, 工作状态 4
04-12-2011  14:28:03     外部交流电压 218, 主回路电压 27.347,主回路电流 0.099, 工作电池箱 1,工作电池组 0, 工作状态 4
Now I want to read "外部交流电压" "主回路电压" "主回路电流" datas according to the time sequence and restore them in three arrarys: :data[i][6]、data[i][7]、data[i][8]   And them plot them on a graph separately . Year,month,date ,hour and time is separately stored in these arrars.

data[i][0] 、data[i][1]、 data[i][2] 、data[i][3]、data[i][4]

However,I don't know how to realize it.

Expecting you to help me. The attachment is the file which I want to read datas from.

Thank you very much.

Best regards.

 

xiepei

 

I wouldn't care success or failure,for I will only struggle ahead as long as I have been destined to the distance.
0 Kudos
Message 1 of 7
(4,018 Views)

the attachment

I wouldn't care success or failure,for I will only struggle ahead as long as I have been destined to the distance.
0 Kudos
Message 2 of 7
(4,017 Views)

Hi xiepei,

 

What is the difference to this post ? For me it appears to be the same formatting/scanning issue...

 

Because I can't read chinese characters, there is little to understand (and little to help)...

 

And finally, this forum is mostly meant for questions specific to CVI, not about C in general. Did you have a look at the sample arrayfile provided with CVI? It treats a cloesely related subject and already might give you some ideas.

0 Kudos
Message 3 of 7
(4,010 Views)

Moreover it also appears to be identical to this thread

0 Kudos
Message 4 of 7
(3,998 Views)

Hi !

http://http://forums.ni.com/t5/LabWindows-CVI/Read-datas-of-txt-file-according-to-the-list-using-CVI...

Because I didn't find the best solution.It works not well in that post.I am thinking another way to read the txt file and store them in two-dimensional array using CVI.However,I have no idea about realizing it. So I have put this post here,expecting someone  to help me.

It's my mistake,I should not use Chinese characters here. I will modify it.

I wouldn't care success or failure,for I will only struggle ahead as long as I have been destined to the distance.
0 Kudos
Message 5 of 7
(3,977 Views)

Hi

I could not get any help when I put the question to that thread.So it appears here,expecting someone giving me some help.

I'll see to it and will not appear the  identical post.

 

Regards.

 

xiepei

I wouldn't care success or failure,for I will only struggle ahead as long as I have been destined to the distance.
0 Kudos
Message 6 of 7
(3,975 Views)

Hi !

I could not edit the post.Therefor,I correct the post here.

The following is the data stored in my txt file.

04-12-2011  14:27:13     220,  27.368,  0.088,   1,   0,   4

04-12-2011  14:27:23     219,  27.369,  0.1,      1,   0,   4

04-12-2011  14:27:33     220,  27.35,    0.06,    1,   0,   4

04-12-2011  14:27:43     219,  27.35,    0.094,   1,  0,   4

04-12-2011  14:27:53     219,  27.355,  0.073,   1,  0,   4

04-12-2011  14:28:03     218,  27.347,  0.099,   1,  0,   4

04-12-2011  14:28:13     220,  27.355,  0.068,   1,  0,   4

04-12-2011  14:28:23     219,  27.354,  0.076,   1,  0,   4

04-12-2011  14:28:33     219,  27.35,    0.104,   1,  0,   4

04-12-2011  14:30:18     221,  27.362,  0.094,   1,  0,   4

04-12-2011  14:30:28     221,  27.352,  0.082,   1,  0,   4

I want to read the first seven column data(e.g.220),the first eight column data(27.368),and the first nine column data(0.088) according to time sequence and restore them in three arrarys,such as data[i][6]  data[i][7] data[i][8].Then I can plot them separately on three Graph controls.

The front five columns datas,namely,year,month,date,hour,minute (e.g.04\12\2011\14\30) will be stored separately in these five arrarys.data[i][0]  data[i][1] data[i][2] data[i][3] data[i][4]

 

I wouldn't care success or failure,for I will only struggle ahead as long as I have been destined to the distance.
0 Kudos
Message 7 of 7
(3,971 Views)