how to link gui and simulink?

i am trying to transfer some of the test results from simulink to GUI,can you help me.....what am i suppose to do for that?

Answers (3)

Sreeram Mohan
Sreeram Mohan on 7 Nov 2011
Hi Antriksh,
I have not digged deep into it but seems from the description that it might help !
I will explore once i have more time if u find the above submission not helpful.
--sreeram

1 Comment

thanks for this,
ok that solved the problem to some extent,but i am trying to transfer multiple values.

Sign in to comment.

Fangjun Jiang
Fangjun Jiang on 4 Nov 2011
You need to be more specific. Overall, in your GUI function, you can use sim() to run the simulation of your Simulink model. The results can be set up to be saved in the base workspace or function workspace. Then your GUI function will be able to access the results.

6 Comments

i m trying to take the output of simulink(the calculated values that are in display)to GUI to produce the answer to user(in numerical values).
And there are more than one display in simulink,so i have 3-4 values to be transferred.
You'll need to save the result to workspace using the "To Workspace" block, then after the simulation, you'll have access to the saved variables.
By 'To Workspace' you mean 'simout' block?.....i tried that too, it is giving result in max and min form which is not stored in variable to be accessed.so how can i access those???
The block name is called "To Workspace". 'simout' is the parameter which is the name of the variable saved in the workspace. It saves the value of the signal in your model at the specified time step, definitely not just the max and min. You can set the "save format" as "Array" so it's easy to access. Click its help or play with it to understand it first.
thanks for this,
got that array in the workspace,but it is a matrix with so many values,and i am supposed to show a single value in GUI,how will i select(or transfer) the final result value?
If you just want the final value, use simout(end), assuming "simout" is the variable name and it is saved as "array" and it is a scalar signal. Keep in mind, that value changes if you change the simulation stop time. If you simulation stops at 10 seconds, that value reflects the signal value at 10 seconds. If the simulation stops at 100 seconds, that is the signal value at 100 seconds.

Sign in to comment.

Sreeram Mohan
Sreeram Mohan on 4 Nov 2011
You could just simulate the model using the command
sim
and then pass the returned results on to a edit field on a GUI using callback functions !
--sreeram

1 Comment

thanks for the reply......this is what exactly i am trying to do,but i am asking how to transfer those.simulation part is done.

Sign in to comment.

Categories

Find more on Simulink in Help Center and File Exchange

Asked:

on 4 Nov 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!