Community Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Circular Buffer

The attached example VI (saved in LabVIEW 2015) illustrates how to implement a circular buffer. Furthermore, it allows for dynamically changing the size of the buffer while the code is running.

 

circ.png

Comments
altenbach
Knight of NI Knight of NI
Knight of NI
on

I think it could be dramatically simplified:

 

altenbach_0-1703003822678.png

 

EMCCi
Member
Member
on

This works flawless for me, requires no explicit initialization and it's already intended to work as independent circular buffer subVI with the data generation & timing parts removed:

EMCCi_0-1706629871381.png

 

Also, after a little bit of testing I have seen that altenbach (haven't tested Darren one) design unnecessary loses data when the buffer it's already full and gets expanded, placing always a 0 at the beginning of the array in place of the unnecessary deleted element. This design should solve that but I don't know if it adds any extra bad behavior, but I didn't notice any.

 

Also, for array input:

EMCCi_1-1706630433976.png

 

wdenny3885
Member
Member
on

Can you post the VI for that first one above @EMCCi? I built what you have there and testing it, and it just constantly adds the element to the end, that gets cut off in the reshape. I like how simple yours is, but that doesn't really work for me. maybe i could test your VI?

wdenny3885_0-1723941449387.png

wdenny3885_1-1723941462385.png

 

Every time you iterate, the 3 in this iteration, gets reshaped off. Wondering if it is supposed to insert at index 0? was that the intent there? 

 

 

Havordpete
Member
Member
on

@EMCCi can you please provide a VI to your second design? 

Havordpete
Member
Member
on

@wdenny3885 can you please provide a VI of your design? 

EMCCi
Member
Member
on

Sorry guys for not answering. I've been busy.

I don't know why but it doesn't allow to me to upload the VI, says .vi format is not compatible. Maybe a bug??

I leave you this link here, but I think you will need to hurry up before it gets deleted: https://filebin.net/26240j3yiuspq7yg

EDIT: For me works, even for dynamic buffer size, so I would be scared if you tell me that it doesn't.

EDIT2: Backup link with longer live: https://easyupload.io/m/nv86ih

Contributors