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: 

Append to Array Function taking lot of processor resources

I am using a SCXI box with 64 channels, when I read the data I append the new data to the previous data, I am sampling at 500 samples/sec. As the old array becomes bigger than 1000 rows which is 2 secs of data, the processor usage is going up to 50% and from there onwards it is degrading more.If I dont append the data just load the new data into my array the processor usage is only 5%.I need all the data from the 64 channels and I run the appending funtion atleast 10 secs before I clear and add the new data. I am attaching my program with this message, Get data state in my program is where I am appending the data. There are couple more SUb VI's which are needed to run this program, but atleast the main VI should give an idea what I am doing.

Thanks,

Mudda
0 Kudos
Message 1 of 3
(2,255 Views)
Growing arrays is always expensive, because it will require memory reallocations.

You should initialize a 2D array of the maximum expected size at the beginning, keep track of the insert point, and use "replace array subset" to write new data at the insert point.
0 Kudos
Message 2 of 3
(2,249 Views)
I tried that but it didnot help me, I dont know whther I am doing it properly or not. could you please provide me an example how to do it.

Thanks,
Mudda
0 Kudos
Message 3 of 3
(2,232 Views)