I am trying to create a communication interface in simulink real-time where i have to send data of variable size (e.g. I have messages like start/stop which are just a header of constant size, but I also have messages with an attached payload of variable size). I cycle through the desired data using multiport-switch blocks which support inputs of variable size. The TCP Send block of the real-time toolbox however, does not support this. This seems counterintuitive, given as it also takes a length input specifying how long the data input is. Am I overlooking some configuration options in the block?
If not, what is the recommended way to send variable size data via TCP in simulink real-time? My current idea is to apply zero-padding to my data vectors to alter them to a constant size for all cases, while relying on the length input to convince the TCP send block to only send the data I want to send. Would this work? If not, what alternatives are there?
Any help would be greatly appreciated!