Constants and Matlab Workspace
Show older comments
Say I have defined X1 = 20 in a script file and ran the script file. So my Workspace has X1=20.
I open up Simulink and create a model where I create a condition. I compare a new variable X2 (X2 = 40) to X1 in Simulink, and if X2 > X1, then set X1 = 40. I noticed that X1 appears to change to 40 in Simulink but not in the Workspace. Why is that?
So what is the actual value of X1 in Matlab? is it 20 or 40 then? or maybe Im not doing something correctly here?
Accepted Answer
More Answers (1)
dpb
on 7 Mar 2020
1 vote
I've never seen an installation of Simulink but I'm sure it and MATLAB do not share the same workspace...a search finds lots of links on sharing data between the two; just a couple that look probably germane (again, pure guesswork here)
<Share-data-between-workspaces> (all within MATLAB workspaces)
Categories
Find more on Interactive Model Editing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!