Thread Subject: GUI updation

Subject: GUI updation

From: madhavi

Date: 23 Jun, 2008 05:18:01

Message: 1 of 7

my condition is
iam trying to run my simulink model by supply some inputs
while i tries to give inputs to simulink model actually the
outputs from that model has to go as inputs to GUI such tht
the blocks i used there is lke angular gauge ActiveX
control and knob ActiveX controls has to show the readings
accordingly to the output values tht cme from the model

GUI has to update with the runnning simulink model output
so to capture the output from simulink model to GUI

i did this


[filename, pathname] = uigetfile('*.mat', 'Pick an Mat-
file');
if isequal(filename,0) | isequal(pathname,0)
   disp('User selected Cancel')
   mycheck=0
else
   disp(['User selected',fullfile(pathname,filename)])
   mycheck=1
end
if mycheck ==1
    disp('my check value');
    %ret=load(filename);
              getStructure = load(filename);
% get the structure
              getField = cell(fieldnames(getStructure)); %
check name of structure
              getData = getStructure.(getField{ 1} )';
% get all data
              disp('get data');
              %disp(getData);
              handles.GUI_info.volt = getData(: , 2);% get
data vector column
              disp(' 2nd colmn');
                var_data=handles.GUI_info.volt(1);
              disp(var_data);
              handles.activex2.NeedleValue =var_data ;
But while iam running the GUI is updated with the last
value of simulnk output

plzzz......
can any one help me in ths ............

madhavi

Subject: GUI updation

From: Uwe Steinmann

Date: 23 Jun, 2008 08:03:05

Message: 2 of 7

Hi madhavi,

when and how do you run your Simulink model, and into which
variable do you pass the output?

Uwe

"madhavi " <ka_madhavilatha@yahoo.com> wrote in message
<g3nbm9$5e0$1@fred.mathworks.com>...
> my condition is
> iam trying to run my simulink model by supply some inputs
> while i tries to give inputs to simulink model actually
the
> outputs from that model has to go as inputs to GUI such
tht
> the blocks i used there is lke angular gauge ActiveX
> control and knob ActiveX controls has to show the
readings
> accordingly to the output values tht cme from the model
>
> GUI has to update with the runnning simulink model output
> so to capture the output from simulink model to GUI
>
> i did this
>
>
> [filename, pathname] = uigetfile('*.mat', 'Pick an Mat-
> file');
> if isequal(filename,0) | isequal(pathname,0)
> disp('User selected Cancel')
> mycheck=0
> else
> disp(['User selected',fullfile(pathname,filename)])
> mycheck=1
> end
> if mycheck ==1
> disp('my check value');
> %ret=load(filename);
> getStructure = load
(filename);
> % get the structure
> getField = cell(fieldnames(getStructure));
%
> check name of structure
> getData = getStructure.(getField{
1} )';
> % get all data
> disp('get data');
> %disp(getData);
> handles.GUI_info.volt = getData(: , 2);%
get
> data vector column
> disp(' 2nd colmn');
> var_data=handles.GUI_info.volt(1);
> disp(var_data);
> handles.activex2.NeedleValue =var_data ;
> But while iam running the GUI is updated with the last
> value of simulnk output
>
> plzzz......
> can any one help me in ths ............
>
> madhavi
>

Subject: GUI updation

From: madhavi

Date: 23 Jun, 2008 08:18:02

Message: 3 of 7

"Uwe Steinmann" <uwe_steinmann@web.de> wrote in message
<g3nlbp$jpp$1@fred.mathworks.com>...
> Hi madhavi,
>
> when and how do you run your Simulink model, and into
which
> variable do you pass the output?
>
> Uwe
>
> "madhavi " <ka_madhavilatha@yahoo.com> wrote in message
> <g3nbm9$5e0$1@fred.mathworks.com>...
> > my condition is
> > iam trying to run my simulink model by supply some
inputs
> > while i tries to give inputs to simulink model actually
> the
> > outputs from that model has to go as inputs to GUI such
> tht
> > the blocks i used there is lke angular gauge ActiveX
> > control and knob ActiveX controls has to show the
> readings
> > accordingly to the output values tht cme from the model
> >
> > GUI has to update with the runnning simulink model
output
> > so to capture the output from simulink model to GUI
> >
> > i did this
> >
> >
> > [filename, pathname] = uigetfile('*.mat', 'Pick an Mat-
> > file');
> > if isequal(filename,0) | isequal(pathname,0)
> > disp('User selected Cancel')
> > mycheck=0
> > else
> > disp(['User selected',fullfile(pathname,filename)])
> > mycheck=1
> > end
> > if mycheck ==1
> > disp('my check value');
> > %ret=load(filename);
> > getStructure = load
> (filename);
> > % get the structure
> > getField = cell(fieldnames
(getStructure));
> %
> > check name of structure
> > getData = getStructure.(getField{
> 1} )';
> > % get all data
> > disp('get data');
> > %disp(getData);
> > handles.GUI_info.volt = getData(: , 2);%
> get
> > data vector column
> > disp(' 2nd colmn');
> > var_data=handles.GUI_info.volt(1);
> > disp(var_data);
> > handles.activex2.NeedleValue =var_data ;
> > But while iam running the GUI is updated with the last
> > value of simulnk output
> >
> > plzzz......
> > can any one help me in ths ............
> >
> > madhavi
> >

hi

i tried to store the output to the workspace by using a
To Workspace block from the simulnk library

so tht i can use tht variable in my GUI



>

Subject: GUI updation

From: Uwe Steinmann

Date: 23 Jun, 2008 09:09:04

Message: 4 of 7

and you want the GUI to automatically update when there is
new data in the workspace, correct?

Perhaps you can run your GUI routine (that reads the
workspace data) in a permanent loop (or once per second,
using pause). Otherwise the GUI cannot see the new data.
But I don't know if that works parallel with the simulation.
 
Or maybe you can define a callback function of the simulink
model that calls the GUI when simulation has finshed
(see "Using callback functions" of simulink help).

Uwe

"madhavi " <ka_madhavilatha@yahoo.com> wrote in message
<g3nm7q$q08$1@fred.mathworks.com>...

>
> hi
>
> i tried to store the output to the workspace by using a
> To Workspace block from the simulnk library
>
> so tht i can use tht variable in my GUI
>
>
>
> >
>

Subject: GUI updation

From: madhavi

Date: 23 Jun, 2008 09:51:02

Message: 5 of 7

"Uwe Steinmann" <uwe_steinmann@web.de> wrote in message
<g3np7f$87l$1@fred.mathworks.com>...
> and you want the GUI to automatically update when there
is
> new data in the workspace, correct?
>
> Perhaps you can run your GUI routine (that reads the
> workspace data) in a permanent loop (or once per second,
> using pause). Otherwise the GUI cannot see the new data.
> But I don't know if that works parallel with the
simulation.
>
> Or maybe you can define a callback function of the
simulink
> model that calls the GUI when simulation has finshed
> (see "Using callback functions" of simulink help).
>
> Uwe
>
> "madhavi " <ka_madhavilatha@yahoo.com> wrote in message
> <g3nm7q$q08$1@fred.mathworks.com>...
>
> >
> > hi
> >
> > i tried to store the output to the workspace by using
a
> > To Workspace block from the simulnk library
> >
> > so tht i can use tht variable in my GUI
> >
> >
> >
> > >
> >
> hi
thanks
but ur second solution solve my problem (i.e.,Using
callback functions ) can u provide me with some example
tht it can give me an idea
regards
madhavi

Subject: GUI updation

From: Uwe Steinmann

Date: 23 Jun, 2008 11:16:02

Message: 6 of 7

in your simulink model go to "File -> Model properties",
then select "Callbacks" and click on "StopFcn". Here you
can write down some matlab code, that is executed when a
simulation has finished.
In this code you can call your GUI, maybe with an input
argument that leads to the update routine.
I don't have an example and did not test such a procedure
yet, but I hope it works.

Uwe

"madhavi " <ka_madhavilatha@yahoo.com> wrote in message
<g3nrm6$spd$1@fred.mathworks.com>...
>> > hi
> thanks
> but ur second solution solve my problem (i.e.,Using
> callback functions ) can u provide me with some example
> tht it can give me an idea
> regards
> madhavi
>

Subject: GUI updation

From: madhavi

Date: 24 Jun, 2008 04:58:02

Message: 7 of 7

"Uwe Steinmann" <uwe_steinmann@web.de> wrote in message
<g3o0li$r9k$1@fred.mathworks.com>...
> in your simulink model go to "File -> Model properties",
> then select "Callbacks" and click on "StopFcn". Here you
> can write down some matlab code, that is executed when a
> simulation has finished.
> In this code you can call your GUI, maybe with an input
> argument that leads to the update routine.
> I don't have an example and did not test such a procedure
> yet, but I hope it works.
>
> Uwe
>
> "madhavi " <ka_madhavilatha@yahoo.com> wrote in message
> <g3nrm6$spd$1@fred.mathworks.com>...
> >> > hi
> > thanks
> > but ur second solution solve my problem (i.e.,Using
> > callback functions ) can u provide me with some example
> > tht it can give me an idea
> > regards
> > madhavi
> >
>
hi

i tried wt the way u tld but it s not working
i wrote the following code in the stop callback function
%The GUI handles are by default hidden, turn them on
 set(0,'ShowHiddenHandles','on');

%Set up the arguments that will go into the gain block
event callback listener
blk = 'my_add';
event = 'PostOutputs';
listener = @update_Data;

%Create the listener
add_exec_event_listener(blk, event, listener)
so tht after the simulnk model complete simulation it thn
calls the function updata_Data()
tht calls the GUI

but iam getting errors

can u help me what could be dne

it very urgent

regards
madhavi







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
gui updation madhavi 23 Jun, 2008 01:20:06
rssFeed for this Thread

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.

Contact us at files@mathworks.com