LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

extract some data from an array

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.

 

 

Download All
0 Kudos
Message 1 of 10
(3,230 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 10
(3,216 Views)

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.

0 Kudos
Message 3 of 10
(3,175 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 10
(3,168 Views)

Thank you. Your recommendations have been very helpful. I'm reading the data segments and now I'm trying to move on.

Best.

0 Kudos
Message 5 of 10
(3,121 Views)

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!

Download All
0 Kudos
Message 6 of 10
(3,098 Views)

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.

0 Kudos
Message 7 of 10
(3,083 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 10
(3,075 Views)

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.

0 Kudos
Message 9 of 10
(3,023 Views)

Thank you. I'll try this way.

0 Kudos
Message 10 of 10
(3,022 Views)