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: 

How to up-cast array data to a pre-allocated array


@skaley wrote:

I'm attaching a screenshot that shows more of the acquisition VI (had to do some cleanup).

 

For reference, the host code is running on a PXIe-8840, and I am acquiring from an NI 5172 using the recon oscope instrument design library (IDL) template.

 

When I initialize my class I create the i16 and i32 arrays and put them in DVRs.

The de-interleaver (orange block) is part of the IDL and takes in a pre-allocated 2D i16 array to reshape the data from the FPGA. Because I want to scale the data, I want to put that i16 data into the i32 buffer and then scale.

I hang on to the i16 array because this buffer will need to be used on the next acquisition. Recall I am attempting to stream at 5 FPS (5 FPS for the large images, I can hit 20-60 for smaller images) - so this VI is being call inside of an acquisition loop repeatedly. Because I am using preallocated DVRs, I need to put something back in the DVR; this is where the i16 wire branch comes from.

Additionally, I need to use the data outside of this VI for display/logging purposes (I have 8 cards that I am aggregating data from), so that is why we see the i32 wire branch in this screenshot.

 

You both make a good point about the fact that there will need to be a copy of the data, I just want to make sure I am doing it in the most efficient way possible because I am working with such large data sets.

I have tried the implicit coercion and did not see a difference in performance and the Profile Buffer Allocations tool reported the same allocation happening.

 


Mark the DVR for concurrent Read Only and you can safely NOT put anything back in it it will still be the preallocated array it was.


"Should be" isn't "Is" -Jay
0 Kudos
Message 11 of 11
(139 Views)