function x = flipud(x)
%MATLAB Code Generation Library Function
%
% Limitations:
% 
%   1. Cell input is not supported

%   Copyright 1984-2019 The MathWorks, Inc.
%#codegen

coder.internal.allowEnumInputs;
coder.internal.allowHalfInputs;
eml_invariant(nargin > 0,'MATLAB:minrhs');
eml_invariant(~iscell(x), ...
    'Coder:toolbox:CellArraysNotSupported', mfilename);
ONE = coder.internal.indexInt(1);
m = coder.internal.indexInt(size(x,1));
n = coder.internal.indexInt(size(x,2));
npages = coder.internal.prodsize(x,'above',2);
md2 = eml_rshift(m,ONE);
for p = 1:npages
    for j = 1:n
        for i = 1:md2
            xtmp = x(i,j,p);
            x(i,j,p) = x(m-i+1,j,p);
            x(m-i+1,j,p) = xtmp;
        end
    end
end
