如何在Simulink中接收串行字符串
我正在尝试阅读串行输入(COM端口)的字符串流,然后显示字符串。我存在的问题是,如果我在数据尺寸字段中指定长度,则字符串的长度可变,而Simulink似乎只能读取字符串。
例如,如果我指定[1 18]的数据大小,我只收到那些长度为18或长度大于18的字符串。如果我指定[1 80],我只收到长度为80或更大的字符串所以。如果字符串长于指定的大小,则将字符串截断为指定的大小。
我无法解决此问题,文档对如何使用(并指定)此参数非常容易。数据大小被描述为“ 输出数据大小或应在每个仿真时间步骤中应读取的值数量。此参数指定为多维数字阵列。数据大小不包括标头或终端值”。
在解决此问题方面的任何帮助都将受到高度赞赏。
I am trying to read a stream of strings from serial input (COM Port) and then display the strings. The issue I am having is that the strings are of variable length and Simulink only seems to be able to read a string if I specify its length in the data size field.
For instance, if I specify a data size of [1 18], I only receive those strings which are of length 18 or have lengths greater than 18. If I specify [1 80], I only receive strings of length 80 or greater and so forth. If the string is longer than the specified size then the string is truncated to the specified size.
I have not been able to resolve this issue and the documentation is very light on how to use (and specify) this parameter. The data size is described as "Output data size, or the number of values that should be read at each simulation time step. This parameter is specified as a multidimensional numeric array. The data size does not include the header or terminator values".
Any help in solving this issue is highly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论