This assignment writes a 'int16' value into a 'double' type.
Ältere Kommentare anzeigen
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
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Simulink Functions finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!