LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Index Array for running data

Solved!
Go to solution

Im confused about the question then.  If there is only one A5 in the 1651 bytes of data then you should be ok, considering it is all read properly.  If there is more than one A5 then youre losing important data because you throw it away on the next iteration of the loop.  It would help to know the requirements and the data format for this.

Matt



-Matt
0 Kudos
Message 11 of 30
(1,174 Views)

I think the problem is with your manipulation of the byte data to strings.  I would recommend working with the original array of U8's when doing the indexing.  You can make your string indicators into numeric indicators and set them to display hex.

 

Of course you also want to write the hex values out to the file as strings to be human readable.

 

The conversion of the U8's to the string is your problem.  You should set it to be a length of two in that input that is unwired.  Right now if you get a byte such as 255,  you'll get a string FF.  But if you get something less than 16, you get a single digit hex number such as F for 15.  So some values are 1 character long, others are two, and yo have an inconsistent number of characters in your strings.  Make it a lenght of two, and you'll have 0F instead.

 

You should also use Write to Text File instead of Write to Binary.  I was trying to figure out where all your extra "spaces" and weird characters were coming in your text file. That is when I saw you were using Write to Binary, and the default setting for that is to Prepend the sizes of the data.  That means the first 4 bytes of the file are binary representing the length of the array.  Then each of those elements have 4 bytes that are binary representing the length of the string element.

 

Fix those two things and try again.  If you still have problems, then at least thing will be clearer for further debugging.

Message 12 of 30
(1,161 Views)

Okay! I got the improvement in formating of the data, the format is better now. 

 

The issue I'm having now, is that I'm trying do do a 'Read from Text File', I'm getting Error(4). After doing a little bit of research, it appears that it is having trouble finding the position pointer. This is true, however I'm not sure how to fix the issue. The data is streaming in, so it is dealing with instantaneous data not static. What's the best way of implementing this? 

 

InstrumentGSE.png

0 Kudos
Message 13 of 30
(1,146 Views)

Andrea,

 

Assuming the issue youre having is that youre trying to locate the value based on an index from your array and then find that value in your file.  Use the get file position block and add the new index to that.



-Matt
0 Kudos
Message 14 of 30
(1,140 Views)

Andrea,

 

You may try restting the file position.  Ive never experienced that error, but it looks like youre at the end of the file and there is no more data to be read.  This could also be becuase you have your acquire and analyze data in the same loop, every iteration of acquire, even if there is no data, you will analyze.  Therefore if you recieve a timeout on the read you may be looking for data that isnt there, hence the error.

 

Look into a producer consumer loop to handle this problem.



-Matt
0 Kudos
Message 15 of 30
(1,130 Views)

The link is a guess of what I think the error is ... but I'm getting Error(4). Would the data moving and continuisously changing have an effect? 

0 Kudos
Message 16 of 30
(1,126 Views)

Why are you writing to a file, only to try to read right back again?

 

I'm sure you have a file pointer error because when you write to the open file, the pointer will be left at the end.  Now you are trying to read from the file where the pointer is at the end which means there is nothing after it to read.

 

If you want to display the data you just wrote in, then attach the indicator to the wire going into the File Write, and delete the File Read function.

0 Kudos
Message 17 of 30
(1,124 Views)

Andrea,

 

I would think not because the data in the file is static when you perform your read file.  Its the same loop and has data dependency so it has to write the data before it reads it and must read the data before it writes it again. 



-Matt
0 Kudos
Message 18 of 30
(1,123 Views)

@matt198717 wrote:

Andrea,

 

I would think not because the data in the file is static when you perform your read file.  Its the same loop and has data dependency so it has to write the data before it reads it and must read the data before it writes it again. 


Huh?

 

0 Kudos
Message 19 of 30
(1,116 Views)

Ravensfan, she was asking if her incoming data being dynamic would affect the read file.  I said no, because the data in the file is static when she performs the read from file.  Also she is looking for the element in the array to display, so i agree with your earlier post, but she should wire the output from search array into index array and then wire that output to her display.  As well as remove the read from file.



-Matt
0 Kudos
Message 20 of 30
(1,114 Views)