07-13-2021 07:13 AM
Hello Labview experts!
I wrote this code to acquire at fixed time interval four signals from as many photodiodes and save them on a .lvm file. I really cannot make the software write the collected data into four columns with time flowing continously (column 0). Could anybody help me please?
Solved! Go to Solution.
07-13-2021 08:02 AM
Hi Geordie,
@GeordieM wrote:
I wrote this code to acquire at fixed time interval four signals from as many photodiodes and save them on a .lvm file. I really cannot make the software write the collected data into four columns with time flowing continously (column 0).
There is some code to determine elapsed time from reading HighResolutionTime. When some time interval has elapsed then you call a case with an EleapsedTime ExpressVI inside. When that ElapsedTime also outputs "time has elapsed" then (and only then) you will write your data because you use that boolean to enable the file writing…
What's the point of those two different ElapsedTime calculations?
Why are there indicators without a label (like "time has elapsed")?
Why does your loop rely on a iteration time of 1s when there is a control to change the sample rate?
07-13-2021 08:11 AM
@GeordieM wrote:
Hello Labview experts!
I wrote this code to acquire at fixed time interval four signals from as many photodiodes and save them on a .lvm file. I really cannot make the software write the collected data into four columns with time flowing continously (column 0). Could anybody help me please?
First of all, get away from that Express vi. It will only cause you problems. When logging data you should always open the file outside the loop (or before starting the DAQ in a state machine) and close the file after the loop (or in a stop state in a state machine). I have attached an quick example to show you how this could be accomplished.
You should also look at TDMS logging. You can configure LabVIEW to log directly to TDMS files via the DAQmx drivers. TDMS is a binary format, but there is an Excel plugin that allows you to read it in Excel.
07-13-2021 08:14 AM
Hi Gerd.
My problem is just with the Save subroutine. I already used this code some time ago successfully but I cannot remember how to set the save subroutine so it gets me an array of data as like as in snapshot below.
Could you please advise?
07-13-2021 08:23 AM
Hi Geordie,
you should get a file like that right now!
What kind of result do you get instead?
(Is there a reason to stick with lvm files? You could either create your own CSV file using simple file functions or use TDMS as suggested before!)
07-14-2021 03:17 PM
Hi Gerd
Thank you very much for your replies
The snapshot below is what I get as I switch to TDMS mode
I don't understand this issue: I was able to print my data as like as in the previous snapshot (I just changed PC) just using the .lvm format
I'd like to have my four channels in as many columns and one extra column reporting record time
07-14-2021 03:57 PM
@GeordieM wrote:
The snapshot below is what I get as I switch to TDMS mode
:Yes, TDMS is a binary format. You will need the Excel plugin to open the TDMS file in Excel, or a TDMS viewer.
@GeordieM wrote:
I don't understand this issue: I was able to print my data as like as in the previous snapshot (I just changed PC) just using the .lvm format
I'd like to have my four channels in as many columns and one extra column reporting record time
What does your file look like now? Knowing that would help to direct you as to what the issue might be.
07-14-2021 04:07 PM
Hi johntrich1971
This is the snapshot of a lvm file as it is generated by Labview.
I know how to remove commas and headers but I'd like to have my sensors readout in four separate columns
Thanks for any help you could give me
07-14-2021 05:27 PM
Hello Geordie,
- Please take the advise that others have given you, there are better ways to do what you are trying to do.
To get the readings as columns double click the "Convert to Dynamic Data" and from the
Input data type select 1D array of scalars - multiple channels
right now you have selected 1D array of scalars - single channel that's why you onle get the data saved as one column.
Saludos.
07-14-2021 05:59 PM
Great! That's just what I was trying to set! Couldn't remember that! Thanks!!!:)