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: 

Insert new value into histograms

Solved!
Go to solution

Hi,


I have a small question about histogram. It may be simple but I don’t have the solution.
I have a value Avg_Energie_3 that I want to insert into a histogram.

As you can see, the value is inserted into an array. This array is plot into a histogram.
Each loop, ‘Avg_Energie_3’ change and the size of the array is +1, so the time to calculate the histogram will be longer with time.

I saw  that the size of the upper histogram is 16384 and the size of the lower is 0 !
What is the solution to keep good performance

Thanks for help

0 Kudos
Message 1 of 6
(3,139 Views)

@Minikisscool wrote:


I saw  that the size of the upper histogram is 16384 and the size of the lower is 0 !
What is the solution to keep good performance


Do you have problems with the range or problems with performance? Your values are U16, so their range is somewhat limited.

For the lower histogram, you need to initialize the feedback node with an zeroed array of the correct size. Yours starts out with an empty array, so any addition of any size array will end with an empty array.

 

Your picture is useless to us, because we don't know what the values of the various controls and arrays are. Can you attach the actual VI? There is also no reason for the local variables. Place the terminals outside the case structure and branch the wires to the two locations they are needed.

 

I don't quite understand the reason for most of your code constructs. can you explain what you are trying to do? Where does the data come from?

0 Kudos
Message 2 of 6
(3,122 Views)

Hi Minikisscool,

 

make your own histogram function without using big arrays!

 

I guess your "Avg Energie" range is known before the measurement. So set up your histogram (range and number of bins). With each new "Avg Energie" value you only need to increment the corresponding bin…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 6
(3,121 Views)

My problem is performance for solution 1.
Each mean are put into an 1D array. With time, the size of the array is big (more > 100k or more)

It's right that input is U16 <0 - 65536> and i want to fit theses values into a 16k or 32k histogram. 16k first.
and my input values will varies between 0 and 65536, so all range of U16

 

I can't attach my VI, because values comes from a FIFO from FPGA.


make your own histogram function without using big arrays! - how do it ?

0 Kudos
Message 4 of 6
(3,104 Views)
Solution
Accepted by topic author Minikisscool

Hi cool,

 

like this:

check.png

 

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(3,101 Views)

Many Thanks, it works fine 🙂
It's the first time, I use this structure

0 Kudos
Message 6 of 6
(3,093 Views)