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

Thread Subject: communication between simulink and matlab gui

Subject: communication between simulink and matlab gui

From: Andrea Monastero

Date: 30 Apr, 2008 10:20:03

Message: 1 of 7

Hi.
I've got a matlab GUI. I want to read outputs of some
simulink blocks from the GUI program and update in real-time
some values of text boxes of the GUI. How can I do?

Thanks.

Subject: Re: communication between simulink and matlab gui

From: Ashwini Deshpande

Date: 01 May, 2008 04:49:03

Message: 2 of 7

"Andrea Monastero" <andrea.monastero@gmail.com> wrote in
message <fv9h4j$t6d$1@fred.mathworks.com>...
> Hi.
> I've got a matlab GUI. I want to read outputs of some
> simulink blocks from the GUI program and update in real-time
> some values of text boxes of the GUI. How can I do?
>
> Thanks.

Hai,

You can write the Simulink Block output values into a .mat
file using 'To File' block and read the same file from the
matlab GUI.

or else similarly you can also make use of 'To Workspace'
block and then read the workspace parameters from the matlab
GUI.

Regards,
Ashwini

Subject: Re: communication between simulink and matlab gui

From: Andrea Monastero

Date: 01 May, 2008 10:38:04

Message: 3 of 7

Yes I know, but in this way, if I run the simulation from
the GUI with the command "sim(...)", I've got to wait the
end of the simulation before execute the instruction which
reads the file. I need a real time response...

"Ashwini Deshpande" <vd.ashwini@mathworks.com> wrote in
message <fvbi3v$624$1@fred.mathworks.com>...

...

> You can write the Simulink Block output values into a .mat
> file using 'To File' block and read the same file from the
> matlab GUI.

...

Subject: Re: communication between simulink and matlab gui

From: Ralph Schleicher

Date: 01 May, 2008 16:41:37

Message: 4 of 7

"Andrea Monastero" <andrea.monastero@gmail.com> writes:

> Yes I know, but in this way, if I run the simulation from
> the GUI with the command "sim(...)", I've got to wait the
> end of the simulation before execute the instruction which
> reads the file. I need a real time response...

Use set_param(bdroot, 'SimulationCommand', 'Start') to run
the simulation asynchronously.

--
Ralph Schleicher, Freelance Engineer http://ralph-schleicher.de

Development * Consulting * Training
Mathematical Modeling and Simulation
Software Tools

Subject: Re: communication between simulink and matlab gui

From: elizabeth weitzel

Date: 09 May, 2008 22:57:03

Message: 5 of 7

Is there a way to plot in a GUI window, realtime, the
values that are being generated by a simulink model? Like
having a scope but within a GUI screen?

-Beth W.









Ralph Schleicher <rs@ralph-schleicher.de> wrote in message
<878wyuvuwu.fsf@echo.mueller-schleicher.i>...
> "Andrea Monastero" <andrea.monastero@gmail.com> writes:
>
> > Yes I know, but in this way, if I run the simulation
from
> > the GUI with the command "sim(...)", I've got to wait
the
> > end of the simulation before execute the instruction
which
> > reads the file. I need a real time response...
>
> Use set_param(bdroot, 'SimulationCommand', 'Start') to
run
> the simulation asynchronously.
>
> --
> Ralph Schleicher, Freelance Engineer http://ralph-
schleicher.de
>
> Development * Consulting * Training
> Mathematical Modeling and Simulation
> Software Tools

Subject: Re: communication between simulink and matlab gui

From: Ralph Schleicher

Date: 10 May, 2008 08:05:14

Message: 6 of 7

"elizabeth weitzel" <elizabeth.weitzel@baesystems.com> writes:

> Is there a way to plot in a GUI window, realtime, the
> values that are being generated by a simulink model? Like
> having a scope but within a GUI screen?

Yes of course. Add a call-back function to your GUI returning
the handles of the UI objects. Write an M-file S-function with
the Simulink signals as input. Query and cache the UI object
handles in the StartFcn, then update the UI objects in the
mdlUpdate procedure. Done that, works like a charm.

--
Ralph Schleicher, Freelance Engineer http://ralph-schleicher.de

Development * Consulting * Training
Mathematical Modeling and Simulation
Software Tools

Subject: Re: communication between simulink and matlab gui

From: elizabeth weitzel

Date: 13 May, 2008 20:53:49

Message: 7 of 7

Thank you very much Ralph. It worked beautifully.

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
realtime elizabeth weitzel 09 May, 2008 19:00:30
gui elizabeth weitzel 09 May, 2008 19:00:30
simulink elizabeth weitzel 09 May, 2008 19:00:30
simulink Andrea Monastero 30 Apr, 2008 06:20:05
communication Andrea Monastero 30 Apr, 2008 06:20:05
gui Andrea Monastero 30 Apr, 2008 06:20:05
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