LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

conversion from dynamic to double bit data

Solved!
Go to solution

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 

 

0 Kudos
Message 1 of 9
(3,352 Views)
Solution
Accepted by topic author kwaris

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.

Message Edited by smercurio_fc on 02-25-2010 01:49 PM
Message 2 of 9
(3,342 Views)

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.  

Message 3 of 9
(3,333 Views)

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

 

0 Kudos
Message 4 of 9
(3,317 Views)

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.

 

 

0 Kudos
Message 5 of 9
(3,300 Views)

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?

0 Kudos
Message 6 of 9
(3,287 Views)
The Write to Spreadsheet file is polymorphic, meaning it adapts to the input datatypes.  By default, it assumes DBL so when you try to 'Create Constant' or 'Create Control' you get numbers.  Instead you need to 1) Drop an array constant onto the BD.  2) Drop a string constant onto the BD and drag onto the Array.  (or use my QD shortcut to convert a string constant to an array) 3) Wire this array of strings to the Write to Spreadsheet VI.  4) Enter your column names
Message 7 of 9
(3,281 Views)

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

 

0 Kudos
Message 8 of 9
(3,269 Views)
You must have set true to append to file? (default is false).
Message 9 of 9
(3,261 Views)