How to Create Queue Data Structure in Matlab
clear all
Q=[1 2 3 10 30 -5]
%insert to the begining of Q
v=100;
Q=[v Q]
%retrieve from the end
w=Q(end)
Q(end)=[]
%As a side note, you can remove any element of Q by setting that element to [], the example below removes the third element
Q(3)=[]