function [z, fdz, zdata] = extractUnaryElwiseData(z)
%extractUnaryElwiseData Prepare object for element-wise unary operation
%
%   [obj, fd, data] = extractUnaryElwiseData(obj) extracts data from the
%   object ready for a unary operation that will not affect the dlarray
%   data format or dimension order.  Use this function to call underlying
%   numeric operations in a way which enables in-place optimizations on the
%   underlying data.
%
%   Use restoreUnaryElwiseData to replace the data after the operation.

%   Copyright 2019 The MathWorks, Inc.

fdz = z.FormattedData;
z.FormattedData = [];
zdata = fdz.Data;
fdz.Data = [];
end
