RosettaCodeData/Task/Stack/MATLAB/stack-1.m

14 lines
141 B
Mathematica
Raw Permalink Normal View History

2013-04-11 01:07:29 -07:00
mystack = {};
% push
mystack{end+1} = x;
%pop
x = mystack{end}; mystack{end} = [];
%peek,top
x = mystack{end};
% empty
isempty(mystack)