Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: How to programatically refresh a Simulink model?

Subject: How to programatically refresh a Simulink model?

From: Paulo Pegado

Date: 30 Jun, 2008 18:44:02

Message: 1 of 3

Hello people,

I wonder if there's a way to programatically refresh a
simulink model, i.e. do the same as the "Refresh Model
blocks" button does when clicked, but programatically.

I'm having a real wierd problem with buses. When I open my
model, if I press the "Start Simulation" button, it works
perfectly, although, if I open the model and press the
"Update Diagram", simulink generates an error when I try to
extract the 'InputSignals' parameter from a bus selector.

I ask about the "Refresh Model blocks" because if I open the
model, press "Refresh Model blocks" then "Update Diagram",
it also works!

in resume:

Open -> Play => OK
Open -> Refresh -> Update Diagram => OK
Open -> Update Diagram => *Error*

Thx in advance.

Subject: How to programatically refresh a Simulink model?

From: Idin Motedayen-Aval

Date: 30 Jun, 2008 22:13:16

Message: 2 of 3

Paulo Pegado wrote:
> Hello people,
>
> I wonder if there's a way to programatically refresh a
> simulink model, i.e. do the same as the "Refresh Model
> blocks" button does when clicked, but programatically.
>
> I'm having a real wierd problem with buses. When I open my
> model, if I press the "Start Simulation" button, it works
> perfectly, although, if I open the model and press the
> "Update Diagram", simulink generates an error when I try to
> extract the 'InputSignals' parameter from a bus selector.
>
> I ask about the "Refresh Model blocks" because if I open the
> model, press "Refresh Model blocks" then "Update Diagram",
> it also works!
>
> in resume:
>
> Open -> Play => OK
> Open -> Refresh -> Update Diagram => OK
> Open -> Update Diagram => *Error*
>
> Thx in advance.

Hi Paulo,
Try this:
h = get_param(bdroot,'object')
h.refreshModelBlocks

http://www.mathworks.com/support/solutions/data/1-18HTMD.html

HTH,
Idin

--
Idin Motedayen-Aval
The MathWorks, Inc.
zq=[4 2 5 -15 -1 -3 24 -57 45 -12 19 -12 15 -8 3 -7 8 -69 53 12 -2];
char(filter(1,[1,-1],[105 zq])), clear zq

Subject: How to programatically refresh a Simulink model?

From: Paulo Pegado

Date: 1 Jul, 2008 11:59:06

Message: 3 of 3

Thanks! It worked beautifully.


Idin Motedayen-Aval <run.signature@MATLAB.for.email> wrote
in message <g4blps$os1$1@fred.mathworks.com>...
> Paulo Pegado wrote:
> > Hello people,
> >
> > I wonder if there's a way to programatically refresh a
> > simulink model, i.e. do the same as the "Refresh Model
> > blocks" button does when clicked, but programatically.
> >
> > I'm having a real wierd problem with buses. When I open my
> > model, if I press the "Start Simulation" button, it works
> > perfectly, although, if I open the model and press the
> > "Update Diagram", simulink generates an error when I try to
> > extract the 'InputSignals' parameter from a bus selector.
> >
> > I ask about the "Refresh Model blocks" because if I open the
> > model, press "Refresh Model blocks" then "Update Diagram",
> > it also works!
> >
> > in resume:
> >
> > Open -> Play => OK
> > Open -> Refresh -> Update Diagram => OK
> > Open -> Update Diagram => *Error*
> >
> > Thx in advance.
>
> Hi Paulo,
> Try this:
> h = get_param(bdroot,'object')
> h.refreshModelBlocks
>
> http://www.mathworks.com/support/solutions/data/1-18HTMD.html
>
> HTH,
> Idin
>
> --
> Idin Motedayen-Aval
> The MathWorks, Inc.
> zq=[4 2 5 -15 -1 -3 24 -57 45 -12 19 -12 15 -8 3 -7 8 -69
53 12 -2];
> char(filter(1,[1,-1],[105 zq])), clear zq

Tags for this Thread

Everyone's Tags:

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.

Tag Activity for This Thread
Tag Applied By Date/Time
simulink refresh model programatically Paulo Pegado 30 Jun, 2008 14:45:13
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics