Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

from workspace -variable .m file to simulink model

Asked by Mihnathul Munthaha Neerulpan on 14 Nov 2013
Latest activity Commented on by Michael Herold on 25 Sep 2014

How can I use a variable used in .m file into the simulink model?

0 Comments

Mihnathul Munthaha Neerulpan

Products

No products are associated with this question.

1 Answer

Answer by Danilo NASCIMENTO on 14 Nov 2013
Accepted answer

You can use a block called "from workspace" in simulink source library.

2 Comments

Why I'm not able use one column data, for 'From workspace' block it says I need two dimensions and at least two columns.

Michael Herold on 25 Sep 2014

Hi,

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)

Danilo NASCIMENTO

Contact us