MATLAB Answers


Bring To Workspace variables from Simulink to base workspace from a matlab function

Asked by Viral Zaveri on 22 May 2019
Latest activity Commented on by Viral Zaveri on 23 May 2019
I am calling and simulating a Simulink model (sim) from a function in an m-script. My Simulink model has "To Workspace" variables simout1 and simout2 . However, simout1 and simout2 do not get published to the base workspace.
function call_test()
function run_test()
I think it has to do with visibility between base and function worksapces. How do I make the "To Workspace" variables to publish on base workspace when simulating the Simulink model from a matlab fucntion.


Sign in to comment.

1 Answer

Answer by Raj
on 23 May 2019
 Accepted Answer

Use Simset. See details here. The 'DstWorkspace' property specifies the workspace in which to assign any variables defined in the model. The default is the current workspace. Change the destination workspace to 'Base'. Hope this helps!!

  1 Comment

Sign in to comment.