This assignment writes a 'int16' value into a 'double' type.
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Simulink Functions dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!