10-12-2022 12:57 PM
Hi guys! I,ve been working on a VI for my bioengineering class and I am trying to design a VI in which I can save the data between cursors using write to measurement file block.
I will add my Vi file. Thanks for your help boys!
10-12-2022 01:35 PM
Hi Stacy,
@StacyM=) wrote:
I,ve been working on a VI for my bioengineering class and I am trying to design a VI in which I can save the data between cursors using write to measurement file block.
That's fine! It's also fine you attached your code instead of showing just some images… 🙂
Is there any problem or do you just want to share some code?
10-12-2022 02:20 PM
Yes My VI is not saving the data between cursors and I think the problem might be related to the event structure, it appears that the program gets stuck on an infinite loop when there are no changes in the "acquire" button. But I included that event structure because if I didn't, the values of the wave graph were deleted. Can you help me fix this problem.
Regards Stacy
10-12-2022 02:42 PM
An Event Structure will return *only* when an event is triggered. In your case, it will only ever return when Acquire is clicked. It's not an infinite loop exactly, more just it gets stuck waiting forever.
A proper architecture here would help (like a Producer-Consumer), but if you're just kinda trying to get something quick and dirty you aren't terribly far off.
Your problem is the nested loops. You only need one loop for this task. Add another event to the Event case that's a Timeout event, and put the Timeout value in a shift register. Put the DAQ Assistant task in the Timeout case.
Add another Event case for clicking the Acquire button. If it's True, change the value in the shift register to 0. If false, to -1 (that will disable the Timeout case, so your DAQ Assistant won't get called).
Last, put the code for your Acquire inside the event case. Right now, the acquisition happens EVERY loop, and you only want it to happen once.
Try something like the attached. It's super quick and dirty and I don't have DAQ hardware hooked up, so it's untested, but it should be close and will at least get you moving forward.
10-14-2022 10:24 AM
Hey Stacy,
What do you mean by saving data between cursors?
10-14-2022 12:51 PM
I want to save the data that is delimited by my cursors in the waveform graph. Only selected data between two cursors will be saved.
10-14-2022 01:00 PM
Thanks a lot I cant open the file you attached im using labview 2019.
10-14-2022 01:27 PM
Sorry about that. Try this one.
10-14-2022 01:54 PM - edited 10-14-2022 02:01 PM
Thank you! I added A waveform chart because I need it for my waveform graph to show all data read by the instrument. with an indexing while loop for it. This changed the data types so I also added a waveform array to waveform block to fix compatibility between the cursors functions. Now the problem I am still having is that its saving but the excel file its empty. No data point are shown in the excel file that its generated when pressing save button.
10-14-2022 02:42 PM
How often are you trying to save? Every 1000, 2000, 3000, 4000 ms...?
What is your major? Bioengineering?