Hi Zubair,
As I can understand, you want to initialize an array in Simulink only after a specific time has elapsed. There are several approaches you can take, below are some methods you might consider:
1. Prepare the Data in MATLAB Workspace and Configure the "From Workspace" Block accordingly:
- Ensure that your array in the workspace is formatted as a time series or as a matrix where the first column represents time steps, and the subsequent columns represent the data points.
- Modify the time data so that the value changes occur at t = 10. For example, if your original data is a matrix data and you want the change to happen at 10 seconds, you might append a row with the initial value at time 9.999 and the new value at time 10.
data = [0, initial_value;
- Open the block parameters and ensure that the data is correctly formatted for the block's expectations (e.g., as a structure with time, signals, and possibly dimensions fields, or as a matrix).
- Make sure the "Interpolate data" option is selected if you want a smooth transition between the data points.
2. Use an Enabled Subsystem:
- If you want to ensure that the data is not read until t = 10, you can use an Enabled Subsystem that contains the "From Workspace" block.
- Create an enable signal that becomes true at t = 10. This can be done using a "Step" block with the Step time set to 10 seconds.
- Connect the enable signal to the Enabled Subsystem.
3. Use the "Step" block:
- If you want the signal values to become zero before t=10 and and values from workspace after that, you can use a "Step" block.
- Use a "Product" block with the "Step" block and the 'From Workspace" block as inputs and you will get the desired results.
Hope this helps!