02-20-2012 04:33 PM
Please help. I am very new and need to figure this out.
I have a 2-D Array of DBL data coming into a case structure which has 6 channels of DAQ voltages. I want to write that data to a file with timestamps before each row. I posted my attempt below. This is what I want the excel file to look like when opened:
Timestamp1, dataA1, dataB1, dataC1, dataD1, dataE1, dataF1
Timestamp2, dataA2, dataB2, dataC2, dataD2, dataE2, dataF2
Timestamp3, dataA3, dataB3, dataC3, dataD3, dataE3, dataF3
etc. etc.
I can't figure this out so any advice would help. I am open to throwing this out completely if you have a way of doing this.
Thanks,
~Chris
02-20-2012 06:46 PM
Why not use Write to Spreadsheet File?
What you need to do is create your array of times as a string, and convert your array of double day to a 2-D array of strings. Build those arrays together (or possibly insert the 1-D array of time strings into the first column of your 2-D array of data strings.) Then write the 2-D array of strings out using Write to Spreadsheet File.
02-20-2012 07:45 PM
How do I create an array of times as a string with different times?
02-20-2012 07:56 PM
You actually have a 1-D array of strings coming out of that inner For Loop now. But feeding it to that concatenate string is immediately flattening it to a single string. But you could also change that shift register to an auto-indexing tunnel.
One problem with that inner For Loop. You are running that as fast as it can. So in all likelihood, every element of that string array is going to have pretty much the same time in it. Is tha twhat you want?
02-20-2012 08:18 PM
I am trying to timestamp each colunm of the 2d array of data. I guess I could send the 2d array of data into the loop and index the timestamp into each column. It makes sense in my head but I am not sure how to do that. Do you have an example?
02-20-2012 08:35 PM
What do you want the time stamp to be? You have a 2-D array of data. How was that acquired? Is there any inherent data acquisition rate to that? Is the data 1 second apart, 1 millisecond apart, 1 day apart? That should all be defined when you acquired the data. Why not put the timestamp with the data when you collect the data?
02-20-2012 09:01 PM
I am acquiring 24 differential signals in the producer loop. Then, in the consumer loop I split the data into 4 parts to manipulate/display/save the data into four seperate files. I have no idea how to add the timestamp and carry it through the splits and data manipulation. See attached code for a reference. Remember I am new. This is not a deliverable software, it is just a program to acquire data and then it will be discarded. I want to learn though so any suggestions are appreciated.
Thanks,
~Chris
02-20-2012 09:17 PM
You can do it by the following way. just write the output array to a spread sheet file.
02-20-2012 09:21 PM
Does this take into consideration the timing of my acuired data? Where do you get 100ms from?
02-20-2012 09:32 PM
It doesn't correlate to your timestamps. The first timestamp is going to be after the last sample you've acquired has already come through. He made up the 100 msec because you haven't said what the timing is.
Instead of asking us to give you something that is going to lead you down the wrong path. Why don't you show us the code you have and we can show you how to implement the timestamp with?