LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing custom channel names to Excel file...

Hey guys,

Thanks for the help everyone's given me so far.  I have come up against another problem that I haven't been able to solve looking through other posts on this forum.  I have data from 4 channels (2 are input channels, the other 2 are just user inputs/VI states).  I want to be able to give my own names to the channel headers that output in excel.  I was given a subVI by a guy here at my school to try but it has one slight problem.  The channel names that I input show up just fine, but the output data is the same for all channels (its the Channel 1 data).  I have attached a screen of the main VI with the subVI boxed and labeled as well a screen shot of the subVI block diagram, the subVI itself, and an example excel output file.

I would appreciate any feedback.

Thanks,
Jeremy

Main VI



SubVI


Download All
0 Kudos
Message 1 of 9
(3,244 Views)
bump
0 Kudos
Message 2 of 9
(3,230 Views)
You've got a couple of major problems with that subVI. First, the control that you are using to pass in data, is a scalar. When you wire dynamic data to that, all that you get is a single point from the dynamic data. You've just lost the data from all other channels. Second, you are repeatedly applying different attributes to the same waveform. All that the for loop is doing is overwriting the attribute that was written before. In order for this to work, you would need to pass in an array of waveforms. You only posted a small image of your program. Why don't you post the entire thing so someone can tell how you are acquiring the data in the first place. If you are using the DAQ Assistant, you can name the channels there.
0 Kudos
Message 3 of 9
(3,190 Views)
I realize that I can rename some of the channels from DAQAssistant, but there are 2 channels that I can't name in DAQAssistant because they are just True/False values at different locations in the VI as well as user inputs in the VI.  I've attached the main VI here though not with the subVI.

THanks,
Jeremy
0 Kudos
Message 4 of 9
(3,186 Views)
You can fix this VI so it works by making two changes.
  1. Change your input so it is a dynamic data type (not a scalar)
  2. Change your convert from dynamic data node so the output is an array of waveforms.
tst has already explained why you have the problems.  This will take care of them.
0 Kudos
Message 5 of 9
(3,180 Views)

This example shows why I don't like to use dynamic data. It hides the actual data types being used. Though you did not include some of the subVIs, it looks like all of you data is scalars. You can do like DFGray suggests and convert the scalars to dynamic data and apply a channel name to them individually, or convert all of your dynamic data types to scalars and not use the Express VI Write Measurement File. As I said, you can use the lower level file functions to create the file and write the header before the while loop starts and then use a Write Text File to append new lines. A Format Into String could be used to format the data.

0 Kudos
Message 6 of 9
(3,169 Views)
Thanks guys, I really appreciate the feedback you've given.  I'm not sure how to change the scalars to Dynamic data type.  I thought that it was already dynamic data because of the type of wire that it was.  Shows how much I know.
0 Kudos
Message 7 of 9
(3,166 Views)
The wires that you have going into the last Merge Signals function are scalars. They are not the thick, dark blue lines of the dynamic data. Use the To DDT function on the Express>Signal Manipulation to convert something to Dynamic Data or the From DDT to convert dynamic data to something else.
0 Kudos
Message 8 of 9
(3,160 Views)
I totally agree.  Use dynamic data types only when you absolutely have to.  The variable data type will drive you nuts.  Note that under the hood, a dynamic data type is always an array of waveforms, so it is a very inefficient way to store anything but waveforms.
0 Kudos
Message 9 of 9
(3,138 Views)