Character Variables in Simulink
조회 수: 26 (최근 30일)
이전 댓글 표시
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.
Code:
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.
댓글 수: 0
채택된 답변
Kaustubha Govind
2011년 11월 3일
편집: John Kelly
2015년 2월 27일
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.
댓글 수: 0
추가 답변 (1개)
Seth Popinchalk
2011년 11월 22일
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulink Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!