connect s-function code with GUI m-file variable.

Hi, I have an s function block written in level 1 matlab which has a sine wave input from a simulink model. I want to pass its amplitude value in real time to a variable in the gui m file which is responsible for controlling the movement of an object. Also, I want to know how to draw the sine wave and gui into two different axis because they are always plotted in the same axes while the other axes is empty. Below is my output function of the s function code in which the sine wave input is referred to with u(2)and u(1) referred to time input from a clock.
function sys=mdlOutputs(t,x,u)
fig=guicode;
n=u(2);
sys = []

 Accepted Answer

In regards to passing the data to a GUI, perhaps the appropriate reference would be http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.3F . In particular,
handles = guidata(fig);
would get you access to the handles structure used by the gui.
It would appear to me that it would more appropriate to call guicode in your model initialization code, but that is probably just a matter of efficiency.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!