MATLAB: Data transfer from matlab to simulink and back

MATLAB

How to xfer data from matlab w'space to simulink and back? I tried but it asks for time steps. I want to xfer data that is not time-based i.e. converting from C to F and vice-versa

Best Answer

Since simulation is time-based, Simulink does require inputs to have time-stamps associated with them. You can use the Constant block with your workspace variable entered for its Value parameter. However, that if your variable is an array, then the Constant block will output the entire array at each time-step. If you want your inputs to be processed like a stream, then it might be easier to generate dummy time-stamps depending on your model configuration. For example, if you are using a fixed-step solver with a time-step of 0.2, you can use time-stamps like 0, 0.2, 0.4, and so on. You can log the time vector "tout" for your model to see exactly what time-steps your model is taking and use the same vector as time-stamps for your input.
Related Question