05-29-2020 07:29 AM
Hi, I'm looking forward to extracting each 820 sample packages data from
initial string/array and save them separately at equal time intervals (for example 800ms) then use this every packet in turn in another processing operation. As if I were reading 820 samples packages at equal time intervals.
I built this VI but it doesn't work. I tried a lot of options but I couldn't reach the desired result. So I need help or a bit of advice for which I thank in advance.
05-29-2020
07:56 AM
- last edited on
05-12-2025
09:15 AM
by
Content Cleaner
@AncD wrote:
I built this VI but it doesn't work.
You need to be more specific. What about it doesn't work? I will go through a list of things you need to change, but you need to better describe your observations so people know what to look for. If you describe good enough, some people will know your issue without even opening your code.
With that said...
You are repeatedly reading the same 820 rows. What you should do is open the file before you even enter a loop. Then use a While loop so you can stop when you reach the end of the file (error code 4). Use the Read From Text File inside of the loop to read the data. You can right-click on this function and choose "Read Lines". Wire up 820 to the number of lines. You will now read 820 lines each time you read and the file pointer will update with each read. Use Fract/Exp String To Number to convert your values to numerics. Then you need to make sure you close the file after the loop is complete.
And what analysis are you trying to do? Your current analysis makes no sense at all. You might also want to consider using a Producer/Consumer setup where you read the data and pass it to another loop for the analysis. This will make it so you can be reading more data while you process it. It also makes your code more modular because you can reuse the analysis loop if you change to a DAQ system instead of the signal file.
05-29-2020 12:16 PM
Thank you for your answer. I will be more specific. I have a string of data recorded by an EEG device and I want to cut this string into equal segments of 820 samples that to be read at a time interval of 800ms one after the other. After reading these segments, one by one,I will analyze each of them, but I have not yet included the analysis part in the device because this part, reading segments, still gives me headaches. I was able to read the first 820 samples and visualize them on a chart, but the device does not continue reading the next 820 samples but only visualizes the same ones.
If I attach a constant to N-loop counter, it shows me the same segment N times.
Thank you again.
05-29-2020 12:33 PM
@AncD wrote:
Thank you for your answer. I will be more specific. I have a string of data recorded by an EEG device and I want to cut this string into equal segments of 820 samples that to be read at a time interval of 800ms one after the other. After reading these segments, one by one,I will analyze each of them, but I have not yet included the analysis part in the device because this part, reading segments, still gives me headaches. I was able to read the first 820 samples and visualize them on a chart, but the device does not continue reading the next 820 samples but only visualizes the same ones.
If I attach a constant to N-loop counter, it shows me the same segment N times.
Thank you again.
Yep, I cover all of that in the rest of my first post.
05-30-2020 11:54 AM
Thank you. Your recommendations have been very helpful. I'm reading the data segments and now I'm trying to move on.
Best.
06-01-2020 12:48 PM
Hi LabVIEW,
I am stuck in building a VI to extract chunks data. The VI must read 820 lines in one iteration but read the same first 820 lines in every iteration. I don't know what should be changed on this VI to work. I can't give the line limits to Read From Text File to count from line 820, for example, to 1640, and I don't know what to complete or modify the VI to get past the difficulty.
I need some help. Please!
06-01-2020 01:13 PM - edited 06-01-2020 01:13 PM
I don't understand what you are asking.
First you say you want to read the same 820 lines each iteration. Why?
Then you say read from line 820 to 1640. That is contradictory as that is a different 820 lines.
06-01-2020 01:22 PM
@AncD wrote:
I am stuck in building a VI to extract chunks data. The VI must read 820 lines in one iteration but read the same first 820 lines in every iteration. I don't know what should be changed on this VI to work. I can't give the line limits to Read From Text File to count from line 820, for example, to 1640, and I don't know what to complete or modify the VI to get past the difficulty.
I need some help. Please!
You need to Open the file before the loop and close it after the loop. Go read the entirety of the second paragraph from my first post in this thread.
06-02-2020 01:54 AM
Thanks for your quick answer. You're right, I should have been more specific. I want to read 820 lines at each iteration, but not the same 820 lines but always the following lines to the end of the file. In short, successive chunks of 820 lines from the beginning to the end of the file.
06-02-2020 01:55 AM
Thank you. I'll try this way.