Just Sharing Knowledge on Robotics, Electronics and Programming

Wednesday, April 29, 2015

How To Update Workspace Variabel By Using Simulink



Anytime, we need to update variabel in Workspace by using simulink, there is some way to do it. you can use To Workspace Block in simulink, there is disadvantage if we use this block. this block will update workspace varible in time array. it will result the array variable in workspace,  so for you who want update workspace only single value, you can not use To Workspace Block.

To Update Workspace variable with Single Value by using simulink. you need  Interpreted MATLAB Function block. and use the following script

assignin(ws, 'var', val)

**you can type doc assignin for explanation about it

for example you want update Kp variable in workspace, then you can type the following script in matlab interpreted function

Kp_value =2;
assignin('base', 'Kp_m', Kp_value );

0 comments:

Post a Comment