Simulink function Block / num2str

4 Ansichten (letzte 30 Tage)
Heerlein Fabian
Heerlein Fabian am 3 Nov. 2017
Bearbeitet: Walter Roberson am 3 Nov. 2017
Hello everybody,
I have created a simulink model(with a function Block) and would like to use 2 parameters as input which search automatically in a resistance matrix a resistance value as output. My problem is that I can´t convert a double value into a string via num2str.
Error Message: "The function 'num2str' is not supported for standalone code generation."
I wanted to solve the problem with another function which should convert my double value into a string, but it isn´t working as well.
Error Message: Inferred size for data 'str' is empty, which is invalid for a Simulink signal.
Please Help, Thank you'!

Antworten (1)

Walter Roberson
Walter Roberson am 3 Nov. 2017
Bearbeitet: Walter Roberson am 3 Nov. 2017
Remember, once you initialize a variable, it can never get any larger unless you coder.varsize() it.
Your code Double2String appears to work only for integers. For integers you can use int2str() -- it is supported for code generation. Unfortunately sprintf() is not supported for code generation and num2str is not supported for code generation.
cvklpstunc is correct that characters are not supported as signals (unless perhaps as some kind of custom signal), but you can transfer uint8 or uint16 around and char() them as needed.

Community Treasure Hunt

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

Start Hunting!

Translated by