MATLAB Answers

.m file variable to simulink model

3 views (last 30 days)
RoboKid on 14 Nov 2013
Edited: RoboKid on 17 May 2015
How can I use a variable used in .m file into the simulink model?

Accepted Answer

Danilo NASCIMENTO on 14 Nov 2013
You can use a block called "from workspace" in simulink source library.
Michael Herold
Michael Herold on 25 Sep 2014
i'm not sure if you still have this problem, but when you use a 'From workspace' block you need a signal vector and a time vector. Otherwise the simulation would not know to which time a certain signal value belongs.
If you just have a constant signal over time, you can just put the name of your variable in workspace as value of the constant in the block. It's works also for gains and parameters of masked subsystems (like amplitude of sinus source block)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!