Matlab 2018b Simulink does not recognise the input/output of datatype uint64

1 view (last 30 days)
I try to build a model with a timestamp output, simulink keeps giving me the datatype error and during testing, I found out that as long as I set the output port type to uint64, the error appears. And then if I change it to other type (e.g. uint32, single) the error does not appear. Error message see picture. This situation goes for both input and output for simulink.
Is there anyway to use uint64 data type without error?
I know that it is fixed in higer version of Matlab but due to work reason, I can only use matlab 2018b for model testing and implementation.

Accepted Answer

Andy Bartlett
Andy Bartlett on 1 Jun 2022
Edited: Andy Bartlett on 2 Jun 2022
Way back in the "dark ages" of the 1990s, 64-bit integer were not main stream integer types like 8-bit, 16-bit, and 32-bit were.
Simulink introduced support for "uncommon" integer types from 1-bit up to 128-bits in 1998 as part of Fixed-Point Designer. Support for 64-bit integers was part of this "uncommon" integer type support.
Access to 64-bit integers required using fixed-point type specification approaches. For example,
% Create TYPE SPECIFIERS
% that Simulink Block OutDataTypeStr will accept
%
fixdt(0,64,0) % unsigned 64-bit integer Type SPECIFIER
fixdt(1,64,0) % signed 64-bit integer Type SPECIFIER
% Create Parameter VALUES
% that Simulink Block's will accept
%
fi( 2^40-1, 0, 64, 0) % unsigned 64-bit integer value that
fi( 1-2^42, 1, 64, 0) % signed 64-bit integer value that
In R2017a, changes were begun to make Simulink handling of 64-bit integers similar to 8-bit, 16-bit, and 32-bit integers.
Beginning in R2017a, use of 64-bit integers no longer required a Fixed-Point Designer license.
BUT, for a few more releases, the fixed-point STYLE of specification was still necessary.
In the latest releases, you can specify types to Simulink blocks as int64 or uint64 or you can use the old syntax of fixdt(0,64,0) or fixdt(1,64,0). For blocks like, Gain, Sum, Constant, etc. either specification is fine and equivalent. Since both old and new work in newer releases, there is nothing you need to do when upgrading to newer releases.
For your release R2018a, you need to use the old syntax of fixdt(0,64,0) and fixdt(1,64,0) to specify 64-bit integer types on blocks. When you upgrade to a newer release, you can leave that as is and start to mix-in specifications as int64 and uint64.
This File Exchange download may prove helpful for your work in R2018a.
It contains some utilities, a block library, some example, and
Tips and Tricks for Using 64 bit integers with Simulink.pdf
  1 Comment
xing li
xing li on 2 Jun 2022
Hi Andy,
Thank you so much for your solution and background information. I just tried in my model and it works beautifully.
BR
Xing

Sign in to comment.

More Answers (0)

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!