Comments (2)
Hi!
From a superficial web search it looks like this might be a limitation of Simulink versions before R2020. Do you have the possibility to test with Simulink R2020a or later?
I'm not sure if I've tested uint64 with Simulink, but there some uint64 MATLAB unit tests that pass.
from microbuf.
Hi!
Yes it is simulink limitation, unfortunately i do not have Simulink R2020a or later also I believe even in that version the matlab function block still does not support u/int64 type.
So my temp solution will be convert u/int64 to fi object inside simulink and it works fine from numeric point of view.
Below is the function i use when set output port value for simulink matlab function block:
function yFinal = convertToSimulinkEquivalentType(yInitial)
% convertToSimulinkEquivalentType convert u/int64 to fi equivalent
%
% The outputs of a MATLAB Function Block cannot (currently) be MATLAB's
% int64 or uint64 types. But, they can be the fi object equivalent of
% these without changing any of the mathematical behavior.
%
% This function provides a simple way to workaround the restriction on
% MATLAB Function Block outputs.
% If a desired output yInitial could be a MATLAB int64 or uint64,
% then calculate yInitial however you like
% then just call this function
% yFinal = convertToSimulinkEquivalentType(yIntial);
% and set the output in the MATLAB Function Blocks signature to be
% yFinal instead of yInitial.
%
% It is perfectly fine to call this function even if the input is
% not a MATLAB u/int64. In those cases, the function is just a NO-OP.
%
% In generated code, this function is ALWAYS a NO-OP.
% So there will ALWAYS be ZERO COST in generated code for calling this function.
% The input and output will be the identical variable (or expression).
% In generated code, all 64 bit integer variables having the same
% signedness are equivalent regardless of origin as MATLAB built-in
% or fi object or Simulink signal or Simulink parameter or whatever.
% Since the input and output variable are equivalent no conversion code
% is needed and none will be present. ZERO extra code, ZERO extra ROM,
% ZERO speed penalty!
%
% Copyright 2017-2018 The MathWorks, Inc.
coder.inline('always')
switch class(yInitial)
case 'int64'
yFinal = fi(yInitial,1,64,0);
case 'uint64'
yFinal = fi(yInitial,0,64,0);
otherwise
yFinal = yInitial;
end
end
from microbuf.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from microbuf.