DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading a data file

Hi
I have a data file(.txt) with 3 channels each of these channesl contains datas and their goes upto 3000 odd ...i have no problem untill then..after those channel data, i get some blank space and some junk datas which i dont want the plugin to read...i just want to stop once i find null space or novalue ...so i would be really glad if anyone could help me put in this.....its very urgent.....

i have attached an example file(example.txt) along....kindly go to the end of the channel data to see the unwanted datas....

Regards
Kenni
0 Kudos
Message 1 of 6
(4,089 Views)
Hi Kenni,

First off, I assume you are using the ASCII Import Wizard. On step 3 of 3, you can select the fourth column and the "extra" rows at the end of the file and select Ignore. You can also specify the first row to be a Name channel.

Then, the data you import will still have some NOVALUES. You can get rid of these using the Basic Mathematical Functions>>NoValues in the toolbar of DIAdem: ANALYSIS. This will open the Process NoValues dialog. You can select each of your channels and choose to delete the NOVALUE values. You can also select to have the result channel to be saved in the original channel.

Regards,

Eric M
0 Kudos
Message 2 of 6
(4,062 Views)
hi Eric M
I am not using Ascii Import but rather im using a plugin to import those data files.....

Regards
Flexxy
0 Kudos
Message 3 of 6
(4,056 Views)
Kenni,

I looked into your example file and here is what you find around line 3000 :

0.2999 0.557 0.030
0.3000 0.000 0.006


Value@Time
TIME Pt FWD/REV
mSec Filtered


It looks like the first block of data ends here and another one starts. I am not sure what you expected to happen. Should the plugin create a new group or at least new channels ? Perhaps it would help if you would attach the current status of the plugin together with a brief description of the general file structure.

Thanks

Andreas
0 Kudos
Message 4 of 6
(4,049 Views)
hi andreas,
The datas which i have mentioned below are unwanted datas, i dont want them to get populated in the channels, when they are read by the plugin. I want to stop reading when the pointer reaches the end of the line before the null space (ie."0.3000 0.000 0.008")

Unwanted Datas(below datas):
Value@Time
TIME Pt FWD/REV
mSec Filtered
0 0.043
10 12.259
20 147.081
30 255.318
40 320.110
50 351.732
60 364.044
70 365.514
80 362.552
90 357.876
100 353.080

With regards
flexxy
0 Kudos
Message 5 of 6
(4,050 Views)
I would be able to help you better if you would provide what you already have for a script, but I'll make a couple of assumptions here:

I assume you are creating a block to read in the the ASCII data, something like this:


Dim Group : Set Group = Root.ChannelGroups.Add("MyGroup")
Dim Block : Set Block = File.GetStringBlock()
Dim NextValue : NextValue = File.GetNextStringValue(eString)
While (Not IsEmpty(NextValue)) 'IsEmpty is used to indicate that the end of the line has been reached.
Group.Channels.AddDirectAccessChannel(Block.Channels.Add(NextValue, eR64))
NextValue = File.GetNextStringValue(eString)
Wend

File.SkipLine 'Advance to the next line.
Block.Position = File.Position


Now what you want is for the block to stop reading when it comes to a blank space. There's no way to tell the block this directly, but you can tell the block how long it is, using the BlockLength property. In your case you probably want to figure this number out something like this:


Dim Length : Length = 0
NextValue = File.GetNextStringValue(eR64)
Dim NextValue2 : NextValue2 = File.GetNextStringValue(eR64)
While (Not IsNull(NextValue) And Not IsEmpty(NextValue2))
Length = Length + 1

File.SkipLine()
NextValue = File.GetNextStringValue(eR64)
NextValue2 = File.GetNextStringValue(eR64)
Wend

Block.BlockLength = Length


The reason for calling both IsNull and IsEmpty is that a NULL (aka NoValue) is always returned if the first value on the line is empty.

This code relies on their being a line that is totally empty. You could create an algorithm which uses the fact that you start finding lines with text in them after the block is finished. You could also improve this code by starting a new block and group here and reading these values in too.

I've also attached this code as a complete DataPlugin.
******************
For tips and tricks on creating VBScript DataPlugins go to http://dataplugins.blogspot.com.
Message 6 of 6
(4,028 Views)