Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Event-based execution of an M-file in Simulink
Date: Mon, 9 Nov 2009 10:49:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 14
Message-ID: <hd8s2t$lse$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257763742 22414 172.30.248.38 (9 Nov 2009 10:49:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 9 Nov 2009 10:49:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2007986
Xref: news.mathworks.com comp.soft-sys.matlab:583508


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.