From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
11-07-2013 09:53 AM
Hi all,
I know this is probably trivial and shouldn't take too long to sort out. For some reason I can't work it out.
I have a producer loop that creates a 1D array every second and sends it to a consumer which then needs to save that line into an LVM file. I can do what I want by creating the 2D array before saving and then overwriting it each time, however I want this to scale to testing that will have millions of data points so I would prefer not to have the 2D array being added to.
How do I get it so the LVM saves 1 line, then effectively presses enter and saves the next line etc etc. I've used exactly the same format on the express VI as I have seen work on other projects however it doesn't seem to work here.
I have attached the code, it saves the data vertically currently but I would like it to be horizontal per iteration.
Using LV2013 to do this.
Many thanks.
Pete
Solved! Go to Solution.
11-07-2013 10:56 AM
Just format the data yourself and save it to the file. Open/Create the file before your consumer loop, write inside, and close after the loop.
11-07-2013 11:06 AM
In addition to Tim's solution, you really should famliarize yourself with proper dataflow and programming techniques.
11-08-2013 03:48 AM - edited 11-08-2013 03:58 AM
Thank you both for the quick reply.
I will implement the suggested, and the fix does work.
Just for curiousity's sake when I append the data on the LVM with write to measurement file it automatically goes to
0 | 0 |
1 | 2 |
2 | 4 |
3 | 6 |
4 | 8 |
5 | 10 |
0 | 0 |
1 | 2 |
2 | 4 |
3 | 6 |
4 | 8 |
5 | 10 |
0 | 0 |
1 | 2 |
2 | 4 |
3 | 6 |
4 | 8 |
5 | 10 |
Where as I want it to go to
0 0 2 4 6 8 10
1 0 2 4 6 8 10
2 0 2 4 6 8 10
etc
How do I tell the array that it needs to be a 1x6 instead of a 6x1?
Thanks again for the solution!
Edit:
With regards to the closing of the queue, I had forgotten to put a timing in there to stop it ramping the CPU usage, but I do think it needs to be in its current position to prevent any loss of data within the queue. If I were to put the stop in the bottom loop and the close queue after it then there could still be data in the queue when it is closed? If the stop button stays at the top then the error will never occur in the bottom loop to stop it. Obviously the data loss problem won't affect this program too much but it could affect a larger program?
Please do correct me. Many thanks
11-08-2013 06:20 AM
WoodySLB wrote:
How do I tell the array that it needs to be a 1x6 instead of a 6x1?
You can't. A 1D array just has 1 dimention.
@WoodySLB wrote:
With regards to the closing of the queue, I had forgotten to put a timing in there to stop it ramping the CPU usage, but I do think it needs to be in its current position to prevent any loss of data within the queue. If I were to put the stop in the bottom loop and the close queue after it then there could still be data in the queue when it is closed? If the stop button stays at the top then the error will never occur in the bottom loop to stop it. Obviously the data loss problem won't affect this program too much but it could affect a larger program?
What I typically do is send some kind of message through the queue to tell the consumer to stop. In this case, I would send an empty array as the stop command. You can then destroy the queue once the consumer loop is complete. That way you don't have to poll to see if the queue is empty.