MATLAB: How to have the From Workspace block output the data at a certain time step in Simulink 6.5 (R2006b)

filefromsimulinktiggertriggered

I have a From Workspace block and I want this block to output the signal at a certain time step and not immediately after starting the simulation.

Best Answer

The Triggered Signal From Workspace block in the Signal Operations library of the Signal Processing Blockset 6.4 (R2006b) can be used to import signal samples from the MATLAB workspace into the Simulink model at a certain time when triggered by the control signal at the input port.
You can also use the following approach to output a signal from workspace at a certain time step:
- use a Lookup Table block instead of the From Workspace block
- enter the time and signal values into the "Vector of input values" and "Table data" fields of the Lookup Table
- create a simple counter based on Sum block and feedback loop to feed the Lookup Table
- place all in an enabled subsystem
Now you should be able to output the signal from workspace when you enable the subsystem. Refer to the attached model example.mdl for more information.
You can also mask the subsystem to provide time and signal data as mask parameters. If you want to be able to output a signal from a mat-file at a certain time step, you can create a even more complex mask. This mask would take the mat-file's name as a parameter and could then load the mat-file's data in the mask initialization function. Note that you might need to properly set parameters like the sample times if you want to use this approach.