Character Variables in Simulink

29 visualizaciones (últimos 30 días)
Jon el 3 de Nov. de 2011
Editada: John Kelly el 27 de Feb. de 2015
I think this should be easy, but it isn't for some reason. What am I missing?
I want to pass a character variable from one block to the next.
busname.busobject = 'characterVariable';
I've also tried declaring 'char' as extrinsic and using:
busname.busobject = char('characterVariable');
but I keep getting this error:
Expression 'busname' for type of data 'busname' (#71) did not evaluate to a valid type.
Error evaluating properties of Simulink.Bus object 'busname' in workspace 'base' (used by block 'SimulinkModelName/MATLAB Function Block Name/ SFunction ').
DataType 'char' did not resolve to a valid data type.
Any help is appreciated.

Respuesta aceptada

Kaustubha Govind
Kaustubha Govind el 3 de Nov. de 2011
Editada: John Kelly el 27 de Feb. de 2015
Characters are not valid Simulink signal types - only numeric, fixed-point, enumerated and bus types (with elements of supported type) are supported. See Data Types Supported by Simulink.

Más respuestas (1)

Seth Popinchalk
Seth Popinchalk el 22 de Nov. de 2011
While characters are not a type you can use on a signal line, you can cast them to an Int8 and then work with that. No blocks in Simulink support characters, so I'm guessing you are using S-functions. If that is the case, you can always cast the input signals back to char and work with them inside the S-functions without problem.


Más información sobre Simulink Functions 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!

Translated by