LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic data convert to 2d array looses channe names

Attached is a work in progress vi "Simple version.vi" that will graph multiple time domain on the same graph, XY with multiple x axis eventually and where ever else the journey takes it.

Here's the issue,

I had made a similiar program in the past which worked well except when choosing different channels or changing graph style the history wasn't plotted. I was using a daq assistant inside a while loop (dynamic data) and the time domain graph kept the history till changing what was shown on the graph.

Now I am using DAQmx read vi inside a while loop which has it's properties linked to a DAQ Assistant outside the while loop (used to remove offsets). The "DAQmx read.vi" outputs 2D array data and then is kept using shift registers. So now the "SelectWF.vi" control doesn't represent the channel names, and has to be put in manually, and the XY graph doesn't list channel names. Is there an easy way to acquire the channel names from the DAQ Assistant outside the while loop and input them into the 2D array so I ony have to put the names into the DAQ Assistant and that's all? Should I be using the "DAQmx task property node"? Problem is it outputs  a format which I can't see how to change it to update the SelectWF.vi control and also the graph legend.
Download All
0 Kudos
Message 1 of 5
(3,656 Views)
I'm not sure I completely understand your question, but it sounds like you want a way to get channel names from a Dynamic Data wire.  This VI should help with that - they are stored as a waveform attribute for each channel called "NI_ChannelName".  You can't directly associate a name with a portion of a numeric array, but you may be able to use the "Active Plot" followed by "Plot Name" properties of the XY Graph to set the plot names using these strings.

Message Edited by Jeff B on 07-17-2006 08:12 AM

Message 2 of 5
(3,636 Views)
Thanks for the vi

I attached a property node (item names) to the selected waveforms input for the SelectWF.vi and used the output of the vi that you attached. The channel selection now shows the correct channel names so that's the most inportant thing solved. I don't really understand what you meant by the property node for the XY graph. I have made a property node for the xy graph and when I choose plot name it needs a string input, not a 1d array of strings. and active plot requires an integer.

Sorry but I'm not really that familiar with labview/programming and the whole string/cluster thing.
0 Kudos
Message 3 of 5
(3,620 Views)
If you right-click your XY Graph and select Create - Reference, you should be able to wire that reference and the channel names into this VI to do the job.  You need to iterate over all the plots using a loop, as this subVI does.  You can do the same in a for loop on your main VI without creating the reference to the graph.  Just place a for loop on your diagram and wire the string array into the loop and instead of creating the reference, use the property node you created inside the loop.
0 Kudos
Message 4 of 5
(3,614 Views)
Thanks a lot Jeff. That vi did what I had hoped.

To sum it up:

The first vi grabs the channels names from the original dynamic data, then use a reference of the graph, and then both wired into the last vi you attached to input the channel names into the graph.

More specific to my VI:

I had to use a SelectWF.vi with the same control as when I select the channels to plot from the DAQmx, but wired the signal input with the DAQ assistant used outside the loop as it was dynamic data. The signal out was then wired to your channel name vi. This meant that when I selected the channels to show on the graph from the DAQmx, the correct names were taken from the DAQ assistant.

I also did this for an XY graph where the y-axis was the first selected channel and all that is selected afterwards gets plotted on the x-axis, but in this case I had to remove the first row from the 1D array of strings as the first name on the graph needed to be the second channel selected and so on.

Sorry if this post is a bit confusing when read, if so I'm happy to re-write.

Thanks again Jeff.
0 Kudos
Message 5 of 5
(3,602 Views)