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 16

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: communication between simulink and matlab gui

From: Ashwini Deshpande

Date: 1 May, 2008 04:49:03

Message: 2 of 16

"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: communication between simulink and matlab gui

From: Andrea Monastero

Date: 1 May, 2008 10:38:04

Message: 3 of 16

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: communication between simulink and matlab gui

From: Ralph Schleicher

Date: 1 May, 2008 16:41:37

Message: 4 of 16

"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: communication between simulink and matlab gui

From: elizabeth weitzel

Date: 9 May, 2008 22:57:03

Message: 5 of 16

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: communication between simulink and matlab gui

From: Ralph Schleicher

Date: 10 May, 2008 08:05:14

Message: 6 of 16

"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: communication between simulink and matlab gui

From: elizabeth weitzel

Date: 13 May, 2008 20:53:49

Message: 7 of 16

Thank you very much Ralph. It worked beautifully.

Subject: communication between simulink and matlab gui

From: Irfan

Date: 11 Jun, 2008 12:56:02

Message: 8 of 16

"elizabeth weitzel" <elizabeth.weitzel@baesystems.com>
wrote in message <g0cv4t$g79$1@fred.mathworks.com>...
> Thank you very much Ralph. It worked beautifully.

Hello Elizabeth

Could you be kind to post an example for plotting realtime
graphs in GUI

IrFaN

Subject: communication between simulink and matlab gui

From: Martin Burger

Date: 11 Jul, 2008 13:04:04

Message: 9 of 16

"Irfan " <irfaan88@gmail.com> wrote in message
<g2oi12$m4u$1@fred.mathworks.com>...
> "elizabeth weitzel" <elizabeth.weitzel@baesystems.com>
> wrote in message <g0cv4t$g79$1@fred.mathworks.com>...
> > Thank you very much Ralph. It worked beautifully.
>
> Hello Elizabeth
>
> Could you be kind to post an example for plotting realtime
> graphs in GUI
>
> IrFaN


Dear Ralph, Dear Elizabeth,

could you exemplify that problem ...

"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. "

or provide mor detail

Thanks in advance


Martin

Subject: communication between simulink and matlab gui

From: cheah

Date: 22 Feb, 2009 15:16:01

Message: 10 of 16

"elizabeth weitzel" <elizabeth.weitzel@baesystems.com> wrote in message <g0cv4t$g79$1@fred.mathworks.com>...
> Thank you very much Ralph. It worked beautifully.

hey..Regarding the that u wanted take real time data from simulink to GUI..I am currently doing something related to this..but i dun have any idea..
can u give some example of code?

Subject: communication between simulink and matlab gui

From: Ralph Schleicher

Date: 23 Feb, 2009 19:06:26

Message: 11 of 16

"cheah " <kawai.boy@gmail.com> writes:

> hey..Regarding the that u wanted take real time data from simulink to
> GUI..I am currently doing something related to this..but i dun have
> any idea.. can u give some example of code?

See <http://ralph-schleicher.de/pub/slui/slui-2008-08-30.zip>, for
a complete example.

--
Ralph Schleicher <http://ralph-schleicher.de>

Development * Consulting * Training
Mathematical Modeling and Simulation
Software Tools

Subject: communication between simulink and matlab gui

From: Saidul Hasnan

Date: 27 May, 2009 21:07:01

Message: 12 of 16

Hi Ralph,

The link doesn't seem to work for me. Could you please re-upload it again?

Regards,
Saidul

Ralph Schleicher <rs@mueller-schleicher.de> wrote in message <871vtpotvx.fsf@echo.mueller-schleicher.i>...
> "cheah " <kawai.boy@gmail.com> writes:
>
> > hey..Regarding the that u wanted take real time data from simulink to
> > GUI..I am currently doing something related to this..but i dun have
> > any idea.. can u give some example of code?
>
> See <http://ralph-schleicher.de/pub/slui/slui-2008-08-30.zip>, for
> a complete example.
>
> --
> Ralph Schleicher <http://ralph-schleicher.de>
>
> Development * Consulting * Training
> Mathematical Modeling and Simulation
> Software Tools

Subject: communication between simulink and matlab gui

From: Phil Goddard

Date: 29 May, 2009 00:22:02

Message: 13 of 16


Another approach, available in more recent versions of Simulink, is to add listeners on blocks using the function add_exec_event_listener.
(I'm not sure when that function was introduced but it exists in R2008b.)

I have uploaded an example UI/model using this approach to the file exchange:
http://www.mathworks.com/matlabcentral/fileexchange/24294

Phil.

Subject: communication between simulink and matlab gui

From: zanna z

Date: 30 Jul, 2010 10:49:04

Message: 14 of 16

"elizabeth weitzel" <elizabeth.weitzel@baesystems.com> wrote in message <g0cv4t$g79$1@fred.mathworks.com>...
> Thank you very much Ralph. It worked beautifully.

could u post an example of this metod? (use s function insted event listener)

Subject: communication between simulink and matlab gui

From: trega trega

Date: 16 Aug, 2011 12:01:16

Message: 15 of 16

"Phil Goddard" <philgoddardNOSPAM@telus.net> wrote in message <gvn9r9$dp0$1@fred.mathworks.com>...
>
> Another approach, available in more recent versions of Simulink, is to add listeners on blocks using the function add_exec_event_listener.
> (I'm not sure when that function was introduced but it exists in R2008b.)
>
> I have uploaded an example UI/model using this approach to the file exchange:
> http://www.mathworks.com/matlabcentral/fileexchange/24294
>
> Phil.


Hello,
I followed your example and it works very nice, thank you for that. However now I need to access both signals from XYGraph block? Could you tell me how to do that? I changed

sTime = block.CurrentTime;
into:
sTime=block.InputPort(2).Data;
In localEventListener function, but now both variables: sTime and data have the same values. What am I doing wrong?

Subject: communication between simulink and matlab gui

From: Arun Badigannavar

Date: 13 Jan, 2012 06:02:07

Message: 16 of 16

"Andrea Monastero" 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.
Hi,
I wants to know
How to take a two dimensional signal from MATLAB workspace to the simulink(other waqy thar 'from workspace')

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 Rodney 4 Dec, 2011 08:45:37
add_exec_event_... Phil Goddard 28 May, 2009 20:24:04
event_listener Phil Goddard 28 May, 2009 20:24:04
gui Phil Goddard 28 May, 2009 20:24:04
rtw Phil Goddard 28 May, 2009 20:24:04
simulink Phil Goddard 28 May, 2009 20:24:04
realtime elizabeth weitzel 9 May, 2008 19:00:30
gui elizabeth weitzel 9 May, 2008 19:00:30
simulink elizabeth weitzel 9 May, 2008 19:00:30
communication Andrea Monastero 30 Apr, 2008 06:20:05
gui Andrea Monastero 30 Apr, 2008 06:20:05
simulink Andrea Monastero 30 Apr, 2008 06:20:05
rssFeed for this Thread

Contact us at files@mathworks.com