08-28-2007 03:57 PM - edited 08-28-2007 03:57 PM
Message Edited by mbeenen on 08-28-2007 03:59 PM
08-29-2007 01:00 AM
Hi Mike,
Generating some meaningful timestamps is probaby no big deal (see attached VI) but your diagram leaves me with a question or two...
You're acquiring an array with every loop - should all the elements in each array get the same timestamp?
The Loop executes periodically, so some time elapses between the last element of the first loop, and the first element of the next loop - yet the arrays are being concatinated. This means the time-difference between elements isn't uniform in the resulting array (making it more trouble to calculate correct times later.)
Perhaps one place to start is: what would you like the resulting spreadsheet to look like? Perhaps:
T0 , T1 , T2 , T3
Sample(T0,0), Sample(T1,0), Sample(T2,0), Sample(T3,0)
Sample(T0,1), Sample(T1,1), Sample(T2,1), Sample(T3,1)
Sample(T0,2), Sample(T1,2), Sample(T2,2), Sample(T3,2)
If not, please clarify your intention!
Cheers.
08-29-2007 12:58 PM
tbd,
Sorry if I was a bit unclear about what I wanted to do. I think it will make more sense how I want to implement the time stamp with my updated VI. You can see where I put my timestamp into the array, and everything works fine with the exception that the time is in the form of seconds. This is where I have my problem, because when it is formatted into the date/time format, it naturally becomes unable to be converted into a double because of the special characters. And I can't convert the array into a string before I create the table because the Build Table VI is unable to accept strings as a parameter. This is the main issue I have with your solution, because although the table has the proper time stamps, I am unsure how I would export it to my spreadsheet VI.
In essence, the problem has two solutions:
1: Find a way to get the time stamp into the array inside the while loop in the proper format
2: Change the way I build the table and export it to the spreadsheet, so that I can convert the array into strings for the timestamp to be inserted.
I would prefer the former over the latter, but any advice would be great.
Thank you,
Mike
P.S Thanks for mentioning the build array function inside the loop, I'm pretty new and forgot that I could use auto-indexing.
08-29-2007 01:27 PM
If you want to use the Express VI for the table, you should be creating a waveform data type and passing this. The way to create a waveform data type is with the Build Waveform function. Wire the current date time to the t0 input of the Build Waveform, wire the array you get from the 34970 measure function to the Y Array input, and wire 1/measurement interval to the dt input of the Build Waveform.
What are you trying to do with the inner while loop? I also don't quite understand the purpose of the decimate array. You are removing every other element for display in the table but then it looks like you want to write everthing to Excel. You've not posted some of the subVIs including the Excel one so I don't know what other mods would need to be made.
08-29-2007 02:00 PM
Hi Mbeenen,
Please take a look at the following discussion forum:
http://forums.ni.com/ni/board/message?board.id=170&message.id=179804&requireLogin=False
08-29-2007 03:21 PM
Here are the sub VI's that I'm using. The inner while loop is designed so that the loop will halt immediately when stopped, and not have to finish its current iteration, as the iteration period is intended to be rather long. I may modify the program to have a programmable start/stop time later, but this is at least my temporary solution. The purpose of the decimate array function is to seperate out the channel label from the actual data so they can be placed as headers in the Excel function. The intent was likely not clear with the lack of the SubVI's. Overall, the display table on the front panel is no longer necessary, it was just for me to see how the table was working in the early stages of development.
The one issue I had with your suggestion is the fact that I the build waveform function only accepts a 1-D array for the waveform input, and with multiple and variable number of channels being used I'm not sure how I could easily manipulate the data I gather into multiple 1-d arrays.
As always the help is appreciated,
Mike
08-29-2007 03:23 PM
08-29-2007 04:31 PM
I managed to fix my issue. It turned out the best solution for me was to create a seperate array of strings in my while loop and then wire that to my spreadsheet VI to be put in as the row headers, similar to what I did with the channel headers. I'm not sure if this is great style, but I guess my primitive knowledge of LabVIEW sometimes forces me to use "backdoor" solutions. Thank you for all the suggestions, I think they really helped stimulate my thinking to get to my solution.
Mike