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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI DAQmx saving data (datalogging)

I'm acquiring data from 4 current channels (DAQ9178 + NI 9221).

I want to log all acquired data to excel file (spreadsheet file) in this form:

#    date        hour/minutes/seconds    CH1[A]    CH2[A]    CH3[A]    CH4[A]
1    3.8.2012    12:53:47        0.2    0.1    0.4    0.35
2    3.8.2012    12:53:47        0.21    0.11    0.41    0.34
3    3.8.2012    12:53:47        0.19    0.10    0.4    0.35
...    ...        ...            ...    ...    ...    ...

I also need option to change "sample rate".

I have problems with data logging data to spreadsheet file. I tried with for loop but then have problems with #. Now I tried to transpose 2D array but I can't add to other constant "build array" which goes to "write to spreadsheet data".

Can anyone help me? Code is attached.

_________________________
Rookie; LV 2011 on WIN 7
0 Kudos
Message 1 of 8
(2,589 Views)

I don't understand your dilemma. You already convert the iteration number to a string. Why not do the same thing to the readings?

Message 2 of 8
(2,576 Views)

If I use "number to fractional string" then I cannot add to "build array" which goes to "write to spreadsheet data". Problem is 2d array...

_________________________
Rookie; LV 2011 on WIN 7
0 Kudos
Message 3 of 8
(2,571 Views)

I can't open your 2011 VI but I bet you mean "Write to spreadsheet file"?  If so, there is already a type conversion VI inside that and you're confusing things by mixing up strings and floats.  Look inside that vi and you'll see.  If you want to use the primitives and convert the data to strings yourself then stick with the primitives and don't use the white VIs that already have the same (or equivalent) functions inside them.  Look at the Write to Text File example VI to see how it uses the primitives to convert the data, open the file, write to the file and then close the file. 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
Message 4 of 8
(2,562 Views)

Does this give you what you want?  You might have to play with the transpose or not.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 8
(2,553 Views)

Yes that helped me a lot. But now is problem with "first column" in spreadsheet.
Number # goes "00 11 22" (if Rate is for example 2 Hz), I want 0,1,2,3,4,5....so "loop iteration" must go outside of for loop.

I also like to show data as indicator for each channel inside for loop. I tried with "string subset" but it's not working because is 1D array.

Thanks

_________________________
Rookie; LV 2011 on WIN 7
0 Kudos
Message 6 of 8
(2,529 Views)

Anyone ??

_________________________
Rookie; LV 2011 on WIN 7
0 Kudos
Message 7 of 8
(2,500 Views)

Hi hlod,

the values of # like 00, 11 are logical. If sampling rate will be greater than 1 (e.g., you will set sampling rate to 2), you will process two samples in one loop iteration. Solution is create inicialized shift register as you can see in attached file. And it is better to show this values graphically on front panel.

I hope it helped.

0 Kudos
Message 8 of 8
(2,478 Views)