How to use double precision functions in a single precision code generated project?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hey,
So if you create a code generation project and set 'Numberic Conversion:' to 'convert to single precision'.
Is there any way to call function that requires double inputs like bitshift in the project?
I get the error, "Function 'bitshift' is not defined for values of class 'single'." during the code generation process.
I tried casting my inputs as double() and using the cast() function but it seems that the conversion will not even let me change variables to double for function calls.
Is this expected?
Brian
0 comentarios
Respuestas (1)
Fangjun Jiang
el 27 de Jul. de 2020
It is not a matter of double or single. The supported data types for this block is "Supported data types: Fixed-point, integer (signed or unsigned), Boolean". Specify the proper data type and then proceed.
1 comentario
Scott McNeil
el 7 de Mzo. de 2023
Should I consider to rebuild the model from scratch, specifying desired data types from the beginning? We have not been able to retro-actively change the data types throughout the model without converters or Cast blocks. They create more overhead for the code. The model was first made without consideration to what type of data our controller will need.
Ver también
Categorías
Más información sobre Iterative Fixed-Point Conversion in Simulink en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!