Simulink function Block / num2str

4 次查看(过去 30 天)
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'!

回答(1 个)

Walter Roberson
Walter Roberson 2017-11-3
编辑:Walter Roberson 2017-11-3
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.

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by