title: Tunable variables Simulink and real-time workshop (RSIM)
body: <p>At the moment I’m working on a Simulink model and interested in getting its C code (batch /.exe file) in order to work with it with no further compilation. I’ve already generated the code (using RSIM) and everything works perfectly when I run the generated .exe file using different inputs with the same length as the inputs used when the batch was created. However, when I change the length of the inputs (my multiple varying-length inputs are read from “from file” blocks that load the .mat files) the simulation crashes. Thus my question is:</p>
  
  <p>Is there any way to specify in the generated code or MATLAB/Simulink (before compiling) that whenever I want to run the batch I would like to modify the length of the input so that all variables' length can be set according to the input?. Something like declaring a variable that specifies the length of the rest variables</p>
  
  <p>To easily illustrate my problem let’s say that my variable input lengths are connected to the input port of a multiport switch (it receives different .mat files with different length). Thus when I run the batch varying the input length in comparison with the lengths when the batch was generated this error appears:</p>
  
  <p>Simulink cannot propagate the variable-size mode from the output port 1 of 'MANUAL/Drive Cycle/Cycle Speed (Anticipated)/Subsystem/caicycle2' to the input port 2 of
  'MANUAL/Drive Cycle/Cycle Speed (Anticipated)/Subsystem/Multiport Switch'. This input port expects a fixed-size mode. The variable-size mode originates from
  'MANUAL/Drive Cycle/Cycle Speed (Anticipated)/Subsystem/caicycle2/MATLAB Function'. Examine the configurations of 'MANUAL/Drive Cycle/Cycle Speed
  (Anticipated)/Subsystem/Multiport Switch' for one of the following scenarios: 1) the block does not support variable-size signals; 2) the block supports variable-size signals but
  needs to be configured for them.</p>
  
  <p>Yes, I already thicked the option the switch offers “allow different input sizes (Results in variable-size output signal)”. This problem not only happens with a switch but further blocks in the signal flow. Could someone give me a hint about how I can tackle this problem? Thanks in advance!</p>