Is there a way to pass variables from SimEvents to Simulink while the simulation is running?

1 view (last 30 days)
I was wondering if there is a way to pass variables from a SimEvents based system to a Simulink based system. Right now I have a two separate systems which use a set of shared global variables. But these are not adjustable once the simulation starts running. Is there a way to define variables in the SimEvents system and pass them into the Simulink system so that I can change certain variables during the simulation?
  1 Comment
Teresa Hubscher-Younger
Teresa Hubscher-Younger on 12 Oct 2015
I might not be understanding exactly what you want to do. But if I had some global variables that I wanted to use in the SimEvents system and the pass them into the Simulink system. I would assign them to attributes and pass them out to Simulink as attributes. You would use the Set Attributes block to assign the value and then the Get Attributes block to pull it out and send it as a signal to Simulink, which then can change the variables. But if you already have it as an attribute, you can manipulate it in SimEvents, including by using the MATLAB Attribute Function block. I'm not sure if this is what you were looking for, but I thought it couldn't hurt to throw out an idea.

Sign in to comment.

Answers (0)

Categories

Find more on Discrete-Event Simulation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!