MATLAB Answers

Ali bbbb
0

Running simulink from GUI, Outputs will not be saved in workspace!!

Asked by Ali bbbb
on 8 Jan 2016
Latest activity Edited by Walter Roberson
on 8 Jan 2016
HI everyone,
I have a simulink file, which I want to run with a push button from GUI, I have used the following lines for the call back function:
simOut = sim('Final_Version','SimulationMode','Normal','AbsTol','1e-5',...
'SaveState','on','StateSaveName','xoutNew',...
'SaveOutput','on','OutputSaveName','youtNew');
my problem is that, when I'm running the simulink file from GUI the blocks that I have set to be saved in workspace doesn't come in the workspace, However when I run the simulink file directly, they appear in workspace! can anyone help me with this??
thanks in advanced!

  0 Comments

Sign in to comment.

1 Answer

Answer by Walter Roberson
on 8 Jan 2016
Edited by Walter Roberson
on 8 Jan 2016

When you start a model from the menus or graphically, then "To Workspace" writes to the Base workspace.
When you start a model from code by calling sim() then "To Workspace" writes to the workspace of the function that makes the call. That function might choose to then assignin('base') the values if it wants them in the base workspace.

  0 Comments

Sign in to comment.