Different time step while saving two dataset from Simulink to workspace using "to workspace" block even after setting the timestep same for both.

5 views (last 30 days)
I am trying to log two datasets from Simulink to two variables using "to workspace" block. I have set time & timestep for both blocks equal, still after logging, the dimensions of data is different.
Similar settings are done for other block except the varibale name.
What would be the reason behind having different dimensions after logging data to workspace?

Answers (1)

Shishir Reddy
Shishir Reddy on 10 Sep 2024
Hey Yash
As per my understanding, you logged two datasets from Simulink to MATLAB workspace using the ‘To Workspace’ block and observed that the dimensions of the data exported are different even if the blocks are configured with the same settings.
Here are a few potential causes of the issue –
  • If one signal is event-driven (e.g., triggered by a specific condition), it might produce fewer data points compared to a continuously sampled signal.
  • Different initial conditions for the signals can lead to different lengths of data if one signal reaches a steady state or a stopping condition before the other.
  • If any data processing or filtering is applied to one of the signals before logging, it might alter the data length.
Debugging steps –
  • Display blocks can be added to the signals before logging to visually confirm they are identical during simulation.
  • ‘Simulation Data Inspector’ can be used to compare the signals during simulation to identify discrepancies. For more information regarding ‘Simulation Data Inspector’, kindly refer the following documentation - https://www.mathworks.com/help/simulink/slref/simulationdatainspector.html
I hope this helps resolving the issue.

Products


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!