Using variable size matrices in Simulink

2 views (last 30 days)
Simulink gurus!
I have a model that uses a triggered subsystem to create a new node when a set of logic conditions is met. The new node is stored in a workspace variable using the Signal to Workspace block in array format. Once that node is added, I need to use the whole, updated matrix from the workspace to run another function within the triggered subsystem, but I cannot get it to propagate the matrix beyond the one specified when I initialize the simulation. I've tried using the From Workspace, Signal from Workspace, Triggered from Workspace, and Constant blocks, and the array, structure, structure with time, and timeseries formats with no luck. Any thoughts? Thanks!

Accepted Answer

Guy Rouleau
Guy Rouleau on 26 Jul 2013
You are going in the wrong direction. Going back in the workspace is not the good approach.
Instead, create a vector in Simulink with the maximum dimension you expect for your vector. Using an assignment block, fill it. Keep it store using a Unit Delay, and gab the "filled" part using a Selector block to send to your function.
  1 Comment
Ryan
Ryan on 30 Jul 2013
The size of the matrix is unknown at the beginning of the simulation, but I set it to be arbitrarily long and it worked as you suggested. Thanks for your help!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!