This assignment writes a 'int16' value into a 'double' type.
Show older comments
Hi,
I use the code below in a function. My input is int16 data type and I assigned this in the code. But I still get the error: This assignment writes a 'int16' value into a 'double' type.
Best regards
function y = fcn(u)
%Input
IC=1;
bufferlength=8000;
persistent accxsignal;
if isempty(accxsignal)
if isequal(numel(IC),bufferlength)
accxsignal = IC;
elseif isscalar(IC)
accxsignal = IC*ones(1,bufferlength);
else
error('IC must either be scalar or the same dimensions as bufferlength')
end
end
%Output
y = int16(accxsignal);
%Update
accxsignal = [u accxsignal(1:end-1)];
end
Accepted Answer
More Answers (0)
Categories
Find more on Simulink Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!