From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extracting Array data.

Solved!
Go to solution

Hello and Happy Friday.

 

I'm reworking a instrument driver for a HP 662X power supplies.  We have four in the lab and I want to have a panel that writes the channel information and reads back what the instrument's setting are.  I have the inputs working fine but I'm having trouble extracting the data from the "Read voltage and current" VI.  What I would like is the reverse of "Build Array subVI  where I can input an array and as the elements come in they are channel to the next available row.  I have attached the program for review which should give you a better understanding of what I'm trying to accomplish here.  Any ideas will be greatly appreciated.  The driver I started with is the one downloaded from NI!

 

Thanks

Gary

0 Kudos
Message 1 of 12
(5,837 Views)

Hi Gary!

 

I may have misinterpreted your question but the function which 'does the opposite of build array' is Index Array.  The two excerts below are equivalent.

 

IndexArray.png

Is this what you were after?


Regards,

Peter D

Message 2 of 12
(5,829 Views)

If your output is a 1-d array of #clusters, then you got a problem. If it is in just #clusters form, use unbundle block.

 

If it is a dynamic data, then use "From DDT" in Express-Signal Manipulation

 

If it is in waveform, you can handle it easily.

 

I can be wrong, i cannot open your vi, i dont'know why.

0 Kudos
Message 3 of 12
(5,823 Views)

Nix the Initialize Array stuff. That's not going to do what you want. Simply take the output(s) of the "Read Output Voltage Current" VI out through the loop. Autoindexing will give you arrays. Then simply use Index Array as shown in the second reply to get the individual values to wire to your separate terminals.

 

Also, your voltage and current controls need to be inside the event case. Otherwise the event case will only see the initial values, and if a user changed them, the new values will not be used.

 

Tip: An alternative is to place the 4 voltage controls into a cluster. Then you can simply use Cluster to Array and Array to Cluster with less wiring.

0 Kudos
Message 4 of 12
(5,815 Views)

I took a quick look at your code but I didn't download the driver and I don't have that instrument. My comment would be to let the for loop create the array for you. Each time that for loop iterates you get one voltage and one current measurement from the address defined by the iteration terminal +1. Just take those 2 measurements and wire them to a auto indexed tunnel on the right side of your for loop. This will create the array and you can index out the values or array to cluster and unbundle as you wish. Also note that there is increment primitive on the numeric pallette instead of using the + primitive.

 

 

Too slow. Like he said ^. lol

Now Using LabVIEW 2019SP1 and TestStand 2019
0 Kudos
Message 5 of 12
(5,812 Views)
Solution
Accepted by topic author ggaryt

Also: why the property node for the VISA resource? Use a wire.

 

Attached is a slight mod showing the use of a cluster instead of individual controls, if you want to try that.

0 Kudos
Message 6 of 12
(5,810 Views)

Thank you for you reply and the solution to my problem.  I now have this driver running as either a stand alone or incorperated into a auto test system.

0 Kudos
Message 7 of 12
(5,749 Views)

Peter,

 

Thank you for your input on extracting array data.  I have this problem when working with arrays and although your solution look like it will work I was having trouble getting the indexing to work with the index array but I'm going to continue with your suggestion so I can get a better understanding of how that index array is controlled for future use.

 

Thanks Again

Gary

0 Kudos
Message 8 of 12
(5,742 Views)

The alternate solution I suggested with the clusters was not intended to be a general solution for extracting array data. It was meant to simply the wiring so you didn't need to use Build Array to create your array from the individual 4 controls and then Index Array to get the array values written to the individual 4 indicators. Index Array is generally used for getting at array elements (or rows/columns). In your original code you didn't even need to use Index Array since a for-loop's auto-indexing capabilities was all you needed.

0 Kudos
Message 9 of 12
(5,739 Views)

smercurio_fc,

 

I have implemented the cluster arrangement you had suggested for the writing of the output data to the channel indicators.  There is a issue with writing the outputs.  The output data isn't getting to the proper indicators with all channels being shifted down one location and channel 4 being written to the first location.  Since I can't see what is going on inside the cluster I'm not sure why this isn't writing to the correct locations.  Could you please take a look at the setup and see if there is anything that I'm doing to keep this from working.

0 Kudos
Message 10 of 12
(5,697 Views)