%% Convert Vector to Existing Data Type
% Create a 1-by-3 vector of 32-bit signed integers.

A = int32([-12 34 56])

% Create a complex number of the data type double.

p = 1+2i

% Convert A to the same data type and complexity as the variable p.

B = cast(A,'like',p)

%
% Copyright 2019 The MathWorks, Inc.