In reality I have nine variables with scalar values. For them, I have built a stack construct (last in first out) with following logic: push (only for three variabled from nine, as an example)
stack(end+1:end+3) = [value1, value2, value3];
read and pop is
value3 = stack(end); stack = ;
value2 = stack(end); stack = ;
value1 = stack(end); stack = ;
In my script I call these code lines over 8 million time each and that is why I wish the time could be less. Can you help me to optimize the code lines and decrease the speed?