Jump to content

Trouble with Dat File Error


Recommended Posts

I am having an issue where a dat file seems to have been corrupted and so I cannot read all of the data. If you look at the dat file, you can see that all of the data is in there, it just seems that somewhere along the way, something happened and the native LabVIEW dat reader errors out on me.

I can use the Read Spreadsheet file to get all of the lines, but they are not in a format that is usable for me, and there is a square character between each entry (my data is a cluster of 10 elements for each entry).

If I change the indicator on the output of the Read Spreadsheet.vi, I can see that the "data" that is in between my data is \s\s\s\##, where the ## is the number of characters that will be following it, aka 2.423 is 05.

Here is a sample line from the file: Fixture\s1\s\s\s\12\s12:10:50\s10/29/10\s\s\s\041437\s\s\s\07S90-284\s\s\s\052.863\s\s\s\s\s\s\s\04Fail\s\s\s)Flow\sRate\sout\sof\sRange\s\sPressure\sin\sRange\s\s\s\s\s\s\s\s\14Retest\sNot\sRequested\s\s\s\0428.6\s\s\s\0460.8\s\s\s

I can use the Search and replace vi to get rid of the spaces (\s) with what ever I want, but the \## I cannot get rid of it for the life of me. I dont care how long each field is, I just want the text.

Please help with my mental block, thanks.

Link to comment

When I try to read back the dat file, I can read the first 133 lines with no problems, and then it errors out saying:

Error 116: Possible reason(s):

LabVIEW: Unflatten or byte stream read operation failed due to corrupt, unexpected, or truncated data.

If I was not using the correct control, it would give me a class conflict error

Edited by dblk22vball
Link to comment

I agree with Paul G. Sounds like it isn't really a text file (which is what the read spreadsheet is for).

Although.To answer your other question about getting rid if \## values.....

These are non-printable ascii values.

Use the "search and replace string" primitive and right-click on it to select "regular expression". Then create a "search" string. Right click on it to select "\" codes display.

Then you can use a string like [\04\12\14]+ to scan and remove the non-printable characters.

Link to comment

I agree with Paul G. Sounds like it isn't really a text file (which is what the read spreadsheet is for).

Although.To answer your other question about getting rid if \## values.....

These are non-printable ascii values.

Use the "search and replace string" primitive and right-click on it to select "regular expression". Then create a "search" string. Right click on it to select "\" codes display.

Then you can use a string like [\04\12\14]+ to scan and remove the non-printable characters.

Or you can use "vi.lib\Utility\config.llb\Escape String.vi" and "vi.lib\Utility\config.llb\Unescape String.vi" which are pretty good for dealing with these things (Although I believe I had to add something to deal with spave character '/20')

//Martin

Link to comment

Or you can use "vi.lib\Utility\config.llb\Escape String.vi" and "vi.lib\Utility\config.llb\Unescape String.vi" which are pretty good for dealing with these things (Although I believe I had to add something to deal with spave character '/20')

//Martin

Indeed. But if you know there are only a couple of escaped chars; then the above example is much faster.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.