Hello I have a data which was captured through serial port I need help on selecting specific datas from the data´s captured. The data format is as follows
...‚.20D20¨G...‚B02DA,20,2,L,50.06,11.96,3.30,2.45,2.65,865,255,93,1205.008,928,P.ñ...‚
.10D30«D...‚?01DA,30,2,S,P,L,P,S,P,M,P,P,R,N,N,D,E,S,80010.,99.999,0.08333¾Ÿ...‚
.20D30¥I...‚?02DA,30,2,L,P,L,P,N,P,M,P,P,R,N,N,D,E,S,1457.6,99.994,0.08333.W...‚.10D31©E...‚
101DA,31,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,M,0,1¥:...‚.20D31£J...‚102DA,31,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,P,M,0,1vh...‚
.10D32§F...‚P01DA,32,0,1.00,15,85,31,27,250,27.0,56,0,3,2,E,N,P,O,P,O,O,P,P,O,P,O,P,P,P,P,F1Ù...‚.20D32¡K...‚
T02DA,32,54,1.53,15,19,29,38,250,27.0,47,58,75,52,E,N,P,P,P,P,P,P,P,P,P,P,P,P,P,P,F[²...‚
.10D17£G...‚.01DA,17,50.00,0,60,-85,0êM...‚
I only need the data's of a kind B02DA,20,2,L,50.06,11.96,3.30,2.45,2.65,865,255,93,1205.008,928,P.ñ
and
B01DA,20,2,L,50.06,11.96,3.30,2.45,2.65,865,255,93,1205.008,928,P.ñ
which are by the way the values will change with certain limits and the ultimate goal is to plot the real time graph of some parameters extracted from these data´s .
I am wondering if anybody could give me some ideas about these problem. To differentiate things these selected items are 15 characters separated by comma and all these selected items are separated from other datas by 3 dots and a comma.
Any help would be appreciated

Okay, is this data that you captured written to a file? I ask because you use the past tense "captured" as this is not a NRT (Near Real Time) application. If it is a NRT application and you recieve this data in chuncks then the way you handle this data is just a bit different that if you were reading it from a file.

However, either way you will need to know about the following vb functions...

InStr, Split, Left, Right, Mid...

Good Luck

Okay, is this data that you captured written to a file? I ask because you use the past tense "captured" as this is not a NRT (Near Real Time) application. If it is a NRT application and you recieve this data in chuncks then the way you handle this data is just a bit different that if you were reading it from a file.

However, either way you will need to know about the following vb functions...

InStr, Split, Left, Right, Mid...

Good Luck

Thanks a lot but I need in Matlab.The statement says captured,yes for the time being these datas are txt files and I extracted the numbers already now.
The new program gives the following results.
80
80
20
2
50
12
3
2
3
890
264
93
1205
860
20
2
50
12
3
2
3
865
255
93
1205
928
30
2
32767
100
30
2
1458
100
31
0
31
0
32
0
1
15
85
31
27
250
27
56
0
3
2
32
54
2
15
19
29
38
250
27
47
58
75
52
17
actually in column vector or we can change it to row vector as well
my questions are
1. how to select specific values which are like these,the main idea behind is to count and store the 10 datas that follow the 20 2,for example 50 12 3 2 3 890 264 93 1205 860 and continue like this whenever the first 2 elements of the data are 20 and 2
20
2
50
12
3
2
3
890
264
93
1205
860
2. I want to see the values after decimal point
I mean for example in the above data 50 is 49.96 and 1205 is 1205.006 and almost all of them have a value after a decimal point I would like to know how to do that as well.
Many Thanks

Okay,... You say you have a bunch of txt files and you want to go through these text files and extract specific data from each file. Now, from what you have told us so far in this thread is that these text files can come in two formats. The first format is in your first post and the second format is in your second post (#3 above).

Now, here are some questions for you.

1.) Are these text files in a single directory?
2.) If they are in a single directory, do you want your program to read these files in one after another automatically or do you want to select one file at a time.

If one file at a time then search the web for Common Dialog Control ShowOpen to find some example on how to use the control. The control comes with VB and you already have it. Right Click on your toolbox>components>select Microsoft Common Dialog control.

Now, if your files are in one directory and you want to have your program read one file after another then search the web for SHBrowserForFolder API VB6 to find examples.

Then you will need to know about any one of the following to be able to make a list of these files. The (Dir function), (FSO (File System Object)), (DriveListBox, DirListBox, FileListBox), (FindFirstFile, FindNextFile API's). (NOTE: Various Technologies grouped by parens().)

Okay, so now you have the decision of one file at a time or all the files in a directory. Either way we now need to get down to being able to open your files and reading them in. So what you will need to read up on from the VB help files are as follows...

FreeFile Function
Open Statement
Input Statement
Input Function
Line Input Function
Close Statement

Each of the above come with examples in the help files.


Now, to be able to help you further, I would like you to use the "Go Advanced" button below when you reply and zip up a couple of each type of file you want to parse with a very detailed explanation of what values you want to extract.


Good Luck

Okay,... You say you have a bunch of txt files and you want to go through these text files and extract specific data from each file. Now, from what you have told us so far in this thread is that these text files can come in two formats. The first format is in your first post and the second format is in your second post (#3 above).

Now, here are some questions for you.

1.) Are these text files in a single directory?
2.) If they are in a single directory, do you want your program to read these files in one after another automatically or do you want to select one file at a time.

If one file at a time then search the web for Common Dialog Control ShowOpen to find some example on how to use the control. The control comes with VB and you already have it. Right Click on your toolbox>components>select Microsoft Common Dialog control.

Now, if your files are in one directory and you want to have your program read one file after another then search the web for SHBrowserForFolder API VB6 to find examples.

Then you will need to know about any one of the following to be able to make a list of these files. The (Dir function), (FSO (File System Object)), (DriveListBox, DirListBox, FileListBox), (FindFirstFile, FindNextFile API's). (NOTE: Various Technologies grouped by parens().)

Okay, so now you have the decision of one file at a time or all the files in a directory. Either way we now need to get down to being able to open your files and reading them in. So what you will need to read up on from the VB help files are as follows...

FreeFile Function
Open Statement
Input Statement
Input Function
Line Input Function
Close Statement

Each of the above come with examples in the help files.


Now, to be able to help you further, I would like you to use the "Go Advanced" button below when you reply and zip up a couple of each type of file you want to parse with a very detailed explanation of what values you want to extract.


Good Luck

Thanks a lot I just solved it I will ask you if I have a difficulty again

This article has been dead for over six months. Start a new discussion instead.