07-28-2021 09:24 AM
I am trying to configure my VI to record DMM data continuously until the VI is stopped. Right now I can only get the data to record via a For loop which means I need to set the amount of data points to be recorded (i.e. in the screenshot I'll have a file with 12 voltage readings). When I change it to a while loop the data stops writing to the file. I tried using the set up from this thread (https://forums.ni.com/t5/LabVIEW/Reading-Data-From-Agilent-34401/td-p/3258814/page/2 ) as well, but could not get it to work. My vi is attached & here is an image:
Any help is greatly appreciated.
07-28-2021 09:29 AM - edited 07-28-2021 09:32 AM
Have you tried using a While Loop?
You really should go through the LabVIEW Basics tutorial
07-28-2021 09:52 AM
Hi -- in my question I noted that I have tried using a while loop and it results in the data not being written to a file. With the simple switch of a for to while loop, no file is created nor data saved.
I tried to build an array with the indices being used as elements, yet still no file is created or data saved:
07-28-2021 11:03 AM - edited 07-28-2021 11:05 AM
I've added shift registers to try and retain the data, but am still running into the same problem from my original post where it is just not creating and logging to a file. I added a table on the front panel and can see new values being stored and the old retained, but am still unsure why it won't write to an external file? Here is my VI:
07-28-2021 11:17 AM
Hello -- I am trying to continuously record values from a DMM until the user stops the VI. Right now I have a VI that displays the readings in a growing table on the front panel. However, I am struggling with getting these values to be written to a file. As I have it, no file is created and no data is stored despite the use of the write to measurement file express VI. Thanks in advance for any help!
07-28-2021 11:48 AM
@mh256 wrote:
Hello -- I am trying to continuously record values from a DMM until the user stops the VI. Right now I have a VI that displays the readings in a growing table on the front panel. However, I am struggling with getting these values to be written to a file. As I have it, no file is created and no data is stored despite the use of the write to measurement file express VI. Thanks in advance for any help!
Why are you building your data point into an array before adding it to your array? Change your initialization outside your shift register to a 1D array and just wire your data point directly to the build array. I think that might fix your problem, but I never use dynamic data nor the Write to Measurement File express vi.
A better approach would be to use standard calls to open, write, and close your file. Open the file before the loop. Write to the file inside the loop. Close the file after the loop has ended.
Unfortunately I can't open your file because I am still running LabVIEW 2019.
07-28-2021 12:30 PM - edited 07-28-2021 12:36 PM
I believe the issue is resolved -- thank you so much!
07-28-2021 01:59 PM
Have you tried using "Write Delimited Spreadsheet" vi instead?
BTW, a 1D array is sufficient to store the data.
07-28-2021 02:18 PM
Thanks for the reply, I appreciate it. I ended up using the standard open, write, close calls as recommended by johntrich1971 which resolved my issue:
That being said, I need a column of the local time when each sample is recorded if you have any insight on ways to integrate that.
07-28-2021 02:30 PM - edited 07-28-2021 02:33 PM
Hi mh,
@mh256 wrote:
Thanks for the reply, I appreciate it. I ended up using the standard open, write, close calls as recommended by johntrich1971 which resolved my issue:
Now you seem to write an ever-growing array into the TDMS file with each iteration of the loop - while you surely only want to save that scalar single new sample of that iteration!
Same problem as in that thread…