02-25-2010 01:23 PM
This might be very simple but I've got confused. I have current data and average data as in code. I want to build array using this data, save it on my hard-disk and open in word with headers(current and average)
Problems:
I input data from both sources into build array as shown, and wire output of build array to write to spreadsheet vi. I get error source is dynamic and sink is double bit. This is the hardest part of my life to figure out which conversion pallete to use.
When I run the vi (lets assume correct conversion pallete is wired and there's no conversion error,) dialog box pops up for file path which keeps coming on
Ideally I would like it to pop up on screen when I press run so that I may browse location to save file and once path is specified vi runs continuously and data is written on spreadsheet while vi is running.
Many thanks for reading and help
Cheers
Solved! Go to Solution.
02-25-2010 01:47 PM - edited 02-25-2010 01:49 PM
Welcome to the evil world of dynamic data. What you actually want to use is the Merge Signals function. When you do that a Convert From Dynamic Data will be automatically added between the Merge Signals and the Write to Spreadsheet File.
You may want to consider using the Write to Measurement File as that accepts dynamic data directly.
As for the filepath, use a shift register.
02-25-2010 01:54 PM
Well I certainly feel a little unclean after using Dynamic Data and those Express VIs but here is a quick mod to show some examples. I use the above hint of the SR to get the file name at the beginning (after writing headers). I had no idea what you were doing, but you were merging signals left and right, so I took the same signal you wired to the graph and wired it into the Write to Spreadsheet VI, LV inserts the proper conversion function. Select Append to File, and Transpose on the Write to Spreadsheet VI and you are all set.
Washing my hands now.
02-25-2010 03:40 PM
Darin, Thanks for help! It works.
I have also noticed that by running vi, we get four columns but itsn't clear which data belongs to which column e.g average data is column 1, 2,3 or 4?
Cheers
02-25-2010 05:29 PM
Last time I didn't even try to think about what you were doing. Now that I look at it I am once again reminded why I don't use express VIs and dynamic data types, but I digress. I am now guessing that you would like to average a signal and have two curves, the current set and a weighted average.
There may or may not be a way to do this with Express VIs and Dynamic Data types. To be honest, if there is I wouldn't use it. What I would do as a start is immediately following each Express VI insert a Dynamic Data to DBL conversion and then Index Array to get the first row. Now you are working with 1D arrays.
02-25-2010 06:31 PM
That's great.
I get now data in two column with headers average and signal. Thanks
Can I ask a question please? I am unsure how you got headers "average and current" at top of the text file. I understand you attached a string constant at the left most of vi but when I right click and choose create>>constant, it brings numeric constant(orange). Could you specify please how to get headers?
02-25-2010 06:44 PM
02-25-2010 07:40 PM
Thanks Darin, I followed your instructions, my code looks exactly similar to yours but I wonder I still dont get headers at the top. Please have a look on attached vi.
Cheers
02-25-2010 08:09 PM