LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I want to thin out the data that is being read 1000 elements at a time.

Thank you for your help.

 

Currently, we are getting current values in real time, reading them 1000 elements at a time and sending them to a FIFO.

I would like to change it so that out of this 1000 data, it is acquired at 198 data intervals.

 

Currently : 0,1,2,3.... .1000

After modification : 0,198,396,594,792,990

 

I also want to extract the next 1000 data flowing in at 198 data intervals from the continuation of the previous 1000 data.

First 1000 data: 0,198,396,594,792,990 → Next 1000 data: 170,368,566,764,962

 

Finally, I am thinking of saving the 256 x 256 x 198 = 12976128 data as an array in a 198 column 65536 row CSV or binary file I am thinking of saving the data as an array.

 

198point.png

 

Attached are the files we are currently using.

The image is the description part above.

Thank you for your cooperation.

Download All
0 Kudos
Message 1 of 22
(346 Views)

Hi Kaoru

 

I'm sharing a very simple vi that you can use to implement your data extraction. 

I created a  for loop to generate a 1000 element array to simulate what you are trying to do. 

_______________________________________

 

I would like to share a few comments about your code if I may. 

It works, and that's what matters. 

However, in LabVIEW you can take advantage of SUB-Vis, witch is basically creating a function that you can reuse in your code so you don't have to repeat the same code over and over again. 
I noticed that in your code there are portions of your code that are repeated code, if you create a sub-vi, you can define inputs and outputs and reuse it anywhere you need. 

Advantages: 

Your code will be smaller (as a rule of thumb. if your code is bigger than your screen, create a sub-vi)

If you need to correct/change something in your code, you change only one time and the other portions will follow. 

It's easier to see and understand. 

 

LVNinja_0-1745252618920.png

 

 

LVNinja_2-1745252662595.png

 

To create a sub-vi, just select the portion of the code you want to create and go to 

menu EDIT - CREATE SUB-VI

 

LVNinja_5-1745253262190.png

 

Your code with Sub-VI looks like this 

LVNinja_6-1745253307280.png

 

 

 

Message 2 of 22
(321 Views)

Hi  LVNinja

 

Thanks for your reply!


I have checked the attached program.

I ran the program with 1000 arrays and 198 to extract, but the Array Indexes to extract indicator shows 0,198,396,594,792.

990 should also be output, but why is it not?

 

Thanks for the advice about using SUB-Vis!
I would like to improve the program to make it easier to read.

0 Kudos
Message 3 of 22
(277 Views)

Hi ikeda,

 


@ikeda_kaoru wrote:

I ran the program with 1000 arrays and 198 to extract, but the Array Indexes to extract indicator shows 0,198,396,594,792.

990 should also be output, but why is it not?


Try to replicate this:

You need to implement some simple math to keep your offset when indexing data from your blocks of 1000 samples…

 

Edit:

There are (of course) other (more efficient) options, especially when the block size and index gap stays the same…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 22
(270 Views)

@ikeda_kaoru wrote:

Hi  LVNinja

 

Thanks for your reply!


I have checked the attached program.

I ran the program with 1000 arrays and 198 to extract, but the Array Indexes to extract indicator shows 0,198,396,594,792.

990 should also be output, but why is it not?


Since you also extract index 0 you get a 1-offset issue, which is quite common. Modify the VI like this:

Yamaeda_0-1745311186085.png

(The round towards -inf is to make sure it doesn't round up so you get 1 too many extractions)

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 22
(265 Views)

Thanks for the advice!

What is the “2” function between Divide and Round Toward-Infinity?
I'd be glad if you could tell me.

0 Kudos
Message 6 of 22
(239 Views)

Thanks for the advice!
I'll try to refer to it.

0 Kudos
Message 7 of 22
(238 Views)

Hi ikeda,

 


@ikeda_kaoru wrote:

What is the “2” function between Divide and Round Toward-Infinity?


That's just a probe placed by Yamaeda when testing the shown code snippet…

 


@ikeda_kaoru wrote:

I'd be glad if you could tell me.


It would help when you would use the citation feature when composing messages (like I do in this message).

This would help us to connect your responses with our messages…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 22
(228 Views)

@GerdW さんは書きました:

Hi ikeda,

 


@ikeda_kaoru wrote:

What is the “2” function between Divide and Round Toward-Infinity?


That's just a probe placed by Yamaeda when testing the shown code snippet…

 


@ikeda_kaoru wrote:

I'd be glad if you could tell me.


It would help when you would use the citation feature when composing messages (like I do in this message).

This would help us to connect your responses with our messages…


 

Thanks for your reply!
I will try to use the quote function from now on.

 

0 Kudos
Message 9 of 22
(221 Views)

@Yamaeda さんは書きました:

@ikeda_kaoru wrote:

Hi  LVNinja

 

Thanks for your reply!


I have checked the attached program.

I ran the program with 1000 arrays and 198 to extract, but the Array Indexes to extract indicator shows 0,198,396,594,792.

990 should also be output, but why is it not?


Since you also extract index 0 you get a 1-offset issue, which is quite common. Modify the VI like this:

Yamaeda_0-1745311186085.png

(The round towards -inf is to make sure it doesn't round up so you get 1 too many extractions)


Hi Yamaeda

 

I have one more question!
I made some improvements based on the program you gave me, but I could not connect the wires.
It is where I connect the 1D array data coming from the FIFO to the Index Array in the For loop.
I am attaching an image and would appreciate your advice.

0 Kudos
Message 10 of 22
(218 Views)