MATLAB: Fast FIFO Array/Other Datatype

datatype suggestionfifo

I'm trying to plot something in real time using an FIFO array. I'm implementing the array using the advice someone else here gave me (thank you!) of the following sort:
array = {1,2,3,4};
array = array(2:end)
array{end+1} = 5
Unfortunately this is a bit too slow for what I'm trying to do :(. Could anyone suggest either an efficient FIFO array-like data structure? Or just a faster way?

Best Answer

array(1:end-1) = array(2:end);
array{end} = newvalue;
This avoids having to grow the array.