LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Storing datas into a 2D array every N cycles

Solved!
Go to solution

I am trying to save data together with the index every N cycles,then put them into a 2D array, 

I managed to save the data every N cycles, but I am having some difficulty of saving them with out the zeros in between.

 

 

E. g

i      y  save every 3 cycles      i      y

0     0                                    0     0

1    10                                   3    30

2    20                                   6    60

3    30

4    40

5    50

6    60

7    70

8    80

9    90

10  100

 

 

Please refer to the attached VI

 

Thank you

 

 

Download All
0 Kudos
Message 1 of 14
(3,141 Views)
Solution
Accepted by topic author Edwingtr34
Message 2 of 14
(3,134 Views)

Thanks JM,

 

Thats helps a lot !...

 

Ed

0 Kudos
Message 3 of 14
(3,119 Views)

Hey JM

 

Sorry to ask you about one more help. Is there any way that I can also limit my 2D array with only the newest 4 obtained data ?

 

For example that,

 

when i or the counter = 19, only the index 18, 15, 12, and 9 together with their values are store in the 2d array instead of all of them, as I am trying to used only the newest data for my calculation. 

 

 

Thanks again ,if you can help me up with this last doubts that I have. I tried using the delete from array block , but I am still unable to get it working right. sorry to ask you for help again , but I am really new to labview....

0 Kudos
Message 4 of 14
(3,111 Views)

Array Subset and Array length can help you achieve that.

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
Message 5 of 14
(3,103 Views)
Message 6 of 14
(3,101 Views)

Hey Guys,

 

Sorry to post this question here, but this is related to the same VI

 

Thanks J. W for showing me how to do the delete from array block, that works perfectly fine.

 

HOWEVER, when I plot the data on the graph, the plots contradict with the values shows in the table, which I really cannot under stand why this is happening. 

 

Please see attached VI

 

 

So sorry to ask this here

 

Ed

0 Kudos
Message 7 of 14
(3,049 Views)

You plot the element 1 of the array data.Lag.jpg

0 Kudos
Message 8 of 14
(3,037 Views)

You need to move to index according to the position, here's a quick draft.

 

 

Message 9 of 14
(3,024 Views)

Overall, that constant growing and shrinking of the array is not such a good idea. It causes memory thrashing. Better would be to have a constant sized history buffer. Here's a quick draft. Modify as needed.

 

 

Message 10 of 14
(3,019 Views)