03-11-2021 08:52 AM
I have a simple data retrieval program and I am having difficulty in logging all the data into a text file. It does work but I only get one string of data.
It is set to loop and retrieve data a set number of times at a set rate but the resultant read buffer and file only show one string?
Any ideas where i am going wrong?
Should the file be a different type? I would prefer t use an excel file but not sure on the data conversion.
Regards
03-11-2021 08:54 AM - edited 03-11-2021 08:57 AM
Hi Compolitus,
@Compolitus wrote:
I have a simple data retrieval program and I am having difficulty in logging all the data into a text file. It does work but I only get one string of data.
It is set to loop and retrieve data a set number of times at a set rate but the resultant read buffer and file only show one string?
Any ideas where i am going wrong?
So there is a problem in your VI when it overwrites the text file instead of appending new data at the end.
As you decided not to attach your VI you need to debug on your own!
(Suggestion: append the new data at the end of the file instead of overwriting the file again and again.)
Next try:
There is a problem in your VI when it only keeps one string in the loop, but does not build an array of strings.
As you decided not to attach your VI you need to debug on your own!
(Suggestion: build an array of strings in the loop instead of keeping the last string.)
03-11-2021 09:09 AM - edited 03-11-2021 09:09 AM
Without seeing your code we can only guess what you have done wrong.
I am guessing you are only saving the first or last measurement.
Why not save every measurement right after you take them?
If writing to disk is causing too long of a delay then use a producer/consumer architecture.
03-11-2021 09:18 AM
Hi GerdW
Wow that was a quick response, Thank you.
I have attached screenshots
Basically an initial wait time and then a selected number of data strings collected at set intervals. Above all works fine but the results in the file are always just one string.
Basically what I need next is a trigger from a "greater than zero" GPIB reading to start the initial wait time (1000ms) and then read in set number of strings (Numeric 2) at the selected repeat rate (milliseconds to wait) time. The results to be stored in the named text or preferably, Excel file.
it sounds easy enough but I am a complete novice here!
regards
Trevor
03-11-2021 09:59 AM - edited 03-11-2021 10:01 AM
Oh where do I begin....
03-11-2021 10:11 AM
Hi RTSLVU
Thanks for that.
Any chance of a block diagram to make it easier for me?
If not, I will try to sort it myself. Ive got this far!
regards and thank you
Trevor
03-11-2021 01:03 PM - edited 03-11-2021 01:06 PM
Hi Trevor,
when you would attach a VI instead of a plain image we would be able to edit your VI.
As you attached only an image you need to edit the VI on your own - which is a good training for you! 😄
(Did I already mention in my first message you forgot to "attach your VI"?)
Examine the example VIs, which come with LabVIEW. None of them is opening an closing files or VISA references with each iteration of a loop…
03-12-2021 02:06 AM
Hi RTSLVU
I tried but still only get one reading stored!!
I have attached the VI file
Any chance of putting the controls in the right place for me
Sorry to ask but would be grateful for any help.
Trevor
03-12-2021 06:27 AM
Hi GerdW
I have attached the file in my last post.
regards
Trevor
03-12-2021 06:47 AM
Hi Trevor,
@Compolitus wrote:
I have attached the file in my last post.
Yes, I noticed. Unfortunately I cannot open your VI right now (see my signature line).
Maybe you could attach a version downconverted to LV2017?