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

1 Ansicht (letzte 30 Tage)
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.
call_test();
function call_test()
run_test()
end
function run_test()
sim('test.slx')
end
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.

Akzeptierte Antwort

Raj
Raj am 23 Mai 2019
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!!

Weitere Antworten (0)

Kategorien

Mehr zu Modeling finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by