08-06-2012 02:29 AM
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.
08-06-2012 07:43 AM
I don't understand your dilemma. You already convert the iteration number to a string. Why not do the same thing to the readings?
08-06-2012 08:01 AM
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...
08-06-2012 09:06 AM
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.
08-06-2012 09:54 AM - edited 08-06-2012 09:54 AM
Does this give you what you want? You might have to play with the transpose or not.
08-07-2012 03:24 AM
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
08-08-2012 05:48 AM
Anyone ??
08-09-2012 03:56 AM
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.