Thread Subject: Event-based execution of an M-file in Simulink

Subject: Event-based execution of an M-file in Simulink

From: Laurens

Date: 9 Nov, 2009 10:49:02

Message: 1 of 1

Depending on the output of a certain block I want to change some parameters in the workspace. So what I want is not really a function but a script.

If the output of the block is equal to one, I want following commands to be executed:

set_param('File','SimulationCommand','pause')
rto = get_param('Object','RuntimeObject)
var = rto.OutputPort(1).Data
set_param('File','SimulationCommand','start')

Basically I pause the simulation and copy the output of block 'Object' in the model 'File' to the variable 'var' in the workspace.

How can I implement this in Simulink?

Thank you in advance.

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com