Reputation: 1
Designing a model which is doing some comparison on data ,fetched from GUI. I have ".m file" which has GUI functionality based on GUI GUIDE.I want to run my .m file (Inside I simulate my model also once data has been read.) I am using one Push Button on GUI.After pushing that button my model starts simulating as per code mentioned below.
h=str2num(get(handles.edit_h,'String'));
l=str2num(get(handles.edit_l,'String'));
options = simset('SrcWorkspace','current');
sim('level_monitor',[],options);
My model gives output as constant values(like 1,2,3,4).I dont want to plot graph on scope but want to use this constant variables in GUI for setting string message on UI.How to access value coming to output port of simulink via GUI function(m-script).
As per my understanding MATLAB code uses its own workspace and Simulink has its own workspace.(Base and model workspace). How to read data available at Simulink outport to my matlab code(GUI .m file)? I have tried using "Simout(To Workspace block) also but it not resolve my issue. Kindly help me out with this.
Upvotes: 0
Views: 174
Reputation: 10762
You should be using the form of the sim
function that returns an output structure, i.e.
simOut = sim('level_monitor',[],options);
simOut
is then a structure that contains fields for all of the variables that the simulation would nominally write to the Base Workspace.
See
>> doc sim
for more information.
Upvotes: 1