LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array reinitialization

Solved!
Go to solution

Hi all,

Here I am trying to use a shift regidter to collect and save data into an array , after the array index reach 1000, this array will be representd in a form of chart. and then  the array should be reinitialize and start saving another set of data and repeat the same proceadure. Can you share me any hint how to do that?

Thanks. 

0 Kudos
Message 1 of 8
(2,454 Views)

Here is the vi in  Labview 2009

0 Kudos
Message 2 of 8
(2,445 Views)

Like this tweaked one?

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 8
(2,442 Views)

Dear Yamaeda,

Appreciate your response, in fact i put that array to understand the concept, your suggested vi is true in that case, but the actual data will be different ( sorry it was my mistake) . In details, the attached vi is a part of program, this program run in a real time mode, i each iteration an array will be obtained, so my objective is to gather those arrays into one array , when the index of the gathered array reach 1000, the gathered array will subjected to classification procedure and then divide each group by certin factor and then plot the distribution chart of the processed 1000 elements. After that the gatehered array should be reinitialized to zero and start saving another 1000 element and apply the same classification process and plot the distribution chart of the second gathered array. the program will continue to do the same process for each 1000 gathered element.

My problem is how to save each 1000 elemnt into an array and then reinitialized this array again to save another 1000 elemnts.

i am try to use a shift register with an empty array, but in thiscase i couldn't control the number of elements saved to this array, and after some time the processing time will increase significantly.

I hope that I explain well my problem.

Thanks again for response...

0 Kudos
Message 4 of 8
(2,391 Views)

Hi MAAM,

 

sounds you like to use a case structure like in this pseudocode:

IF array_size >= 1000
  THEN array:= empty array
  ELSE keep old array data
ENDIF

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 8
(2,372 Views)

Hello GerdW,

thanks for reply,

yes this what i am searching for, but the problem arise how to empty the array after the size reach 1000??

Please, notice that the array data is obtaind from a shift register which is used initate an array as memory, and i think it will better to control this array... am I right???

thanks again...

0 Kudos
Message 6 of 8
(2,363 Views)
Solution
Accepted by topic author M.Ali

Hi MAAM,

 

when the array size grows over 999 you empty the array:

check.png

 

This way you still need to use the internal LabVIEW memory manager as you constantly grow and shrink an array. A better approach is to use ReplaceArraySubset on a fixed-sized array of 1000 elements…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 8
(2,359 Views)

edited.png

Dear GerdW,

That exactly what i am searching for, with a little modification it will do the objective,

thanks for spport.

0 Kudos
Message 8 of 8
(2,347 Views)