Error: The class uint64 does not map to a 64-bit C type.

27 vues (au cours des 30 derniers jours)
Gerd Fuchs
Gerd Fuchs le 21 Avr 2022
Réponse apportée : Ayush Modi le 14 Mar 2024 à 8:52
I've updated Matlab from 2017b to 2020b - because of my tool chain I'm restricted to certain releases and 2020b is the newest relase I can use at the moment. In my Simulink file I've implemented a Matlab function containing the bin2dec command. Everything worked fine in the 2017b release, but now, after the update, I get the error
"For code generation, integer input or result classes for TYPECAST must map directly to a C type in the target hardware. The class uint64 does not map to a 64-bit C type."
Why does this error occur and how can I resolve this issue?
I tried using the 'Bit to Integer Converter' Block from the Communications toolbox but this one doesn't work in my code because I get the value from an FPGA and in the communication interface I don't have the option to specify the number of bits. Hence, at the input, the value has the type 'double' and I have to convert it to a 12bit signed int.

Réponses (3)

Andy Bartlett
Andy Bartlett le 22 Avr 2022
If this error is happening when you are explicitly attempting to generated code with MATLAB Coder, Simulink Coder, or Embedded Coder, then the following may solve the problem.
Make sure Hardware Implementation target provides 64 bit integer type.
Make sure your model's Hardware Implementation target provides a 64 bit integer type. Either
  • long is 64-bits
or
  • long long is 64 bits
  • Support long long is checked.
Some screenshots can be found here.
If this error is occuring due to implicit code generation such as simulating with a MATLAB function block or simulating with accelerator mode then I would not expect the previsous suggestion to solve the problem.

chrisw23
chrisw23 le 21 Avr 2022
Try to use the .net System.Convert class methods. i.e.
System.Convert.ToInt64( <yourVal> )
  3 commentaires
chrisw23
chrisw23 le 21 Avr 2022
Modifié(e) : chrisw23 le 21 Avr 2022
The System class is usable by default as far as I know, but you can try to import it explicitly by
import System.*
The Matlab Command Window should provide the class interface by intellisense if you press the TAB key after the dot System.Convert.<TAB>
...and I'm talking about Matlab not Simulink :)
Gerd Fuchs
Gerd Fuchs le 21 Avr 2022
Probably my question was not stated clear enough. My troubles are concering my Simulink model (in which I also use Matlab functions).

Connectez-vous pour commenter.


Ayush Modi
Ayush Modi le 14 Mar 2024 à 8:52

Tags

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by