DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Ascii file with different line lengths: STP versus dataplugin

We are using ASCII files that have 7 normal columns (channels), but every few lines we add additional measurements that don't need to be sampled at the same freqency as the 7 main columns.

I am able to create an STP file to import these ASCII files manually. Afterwards I can disassemble the data into a fast group and a slow group with a dedicated VBS script.

 

Now I want to automate this:

Problem 1: When using

  Call ASCIIConfigLoad(mySTPFile)

  Call ASCIILoad(myASCIIFile)

The data does not show in the data portal

 

I searched the forum and noticed it is advised to use dataplugins:

 

Problem 2: if the first row of my ASCII file only contains the 7 "main" channels, the dataplugin wizard will not create additional channels for the extra info that comes on the following lines.

However the STP wizard does this correctly?

 

Problem 3: I tried converting the dataplugin to .vbs and find where the number of channels is determined. I have not been able to find my way through it yet.

 

Any help is greatly appreciated.

 

0 Kudos
Message 1 of 6
(4,097 Views)

hey gjvt

you can read a text file with "textfilereadln" function

exemple:

           Dim intMyHandle

           Dim strMyText

           Dim Myligne

           intMyHandle=TextFileOpen("C:/............/gjvt_exemplefile.txt",tfread)
           Do While Not TextFileEOF(intMyHandle)
                        strMyText=textfilereadln(intMyHandle) 

                        MyLigne=Split(strMyText,",",-1,1) 'MyLigne is an array of values of the ligne

           Loop

 

0 Kudos
Message 2 of 6
(4,068 Views)

Hi gjvt,

 

Here's a DataPlugin that loads all your channels and just puts NoValues in the missing cells.  You can either leave the NoValues or remove them with the "ProcessNoValues" ANALYSIS function once the data is in DIAdem.  The DataPlugin uses a similar approach to the ASCII Wizard-- it looks through the first 100 rows and finds the maximum column count from among those rows and declares that many channels.  You could alternatively have the DataPlugin load the slower rate channels without the NoValues by assigning each value in the DataPlugin's VBScript code, but that would execute a little slower.

 

I'm happy to continue to help you with this if you'll give me more guidance about your user scenarios.  At any rate this DataPlugin should be MUCH clearer than what the DataPlugin Wizard gave you.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 3 of 6
(3,997 Views)

Hey Brad,

 

Thanks for looking into this.

I registered the plugin and ran it on the test file (right click the txt file, select "open with", select the gjvt_TXT pluging and click "load").

On the 2KB example file it works fine.

 

However when I try using it on our larger size files ( 14KB and up), DIAdem seems to hang?

In attachement a larger file that demonstrates the issue.

 

BTW my DIAdem version is 11.2.0f4178 in case it would matter.

 

0 Kudos
Message 4 of 6
(3,962 Views)

Hi gjvt,

 

Woops, I had bad logic in the parsing and was missing the end of the header section and reading through the whole file looking for it.  I've fixed that bug and now it loads the larger file you sent.

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 5 of 6
(3,950 Views)

Tested and verified with large files!

Thank you.

0 Kudos
Message 6 of 6
(3,914 Views)