04-21-2025 04:05 AM
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.
Attached are the files we are currently using.
The image is the description part above.
Thank you for your cooperation.
04-21-2025 11:35 AM
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.
To create a sub-vi, just select the portion of the code you want to create and go to
menu EDIT - CREATE SUB-VI
Your code with Sub-VI looks like this
04-22-2025 02:51 AM
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.
04-22-2025 03:36 AM - edited 04-22-2025 03:51 AM
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…
04-22-2025 03:41 AM
@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:
(The round towards -inf is to make sure it doesn't round up so you get 1 too many extractions)
04-22-2025 06:15 AM
Thanks for the advice!
What is the “2” function between Divide and Round Toward-Infinity?
I'd be glad if you could tell me.
04-22-2025 06:16 AM
Thanks for the advice!
I'll try to refer to it.
04-22-2025 06:43 AM
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…
04-22-2025 06:56 AM
@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.
04-22-2025 06:59 AM
@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:
(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.