1 year ago
#381625
KillaKem
How to receive serial strings in Simulink
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.
matlab
serial-port
simulink
0 Answers
Your Answer