How to store value of variables of Matlab Function Block of a Simulink Model into the Matlab Workspace dynamicall​y/continuo​usly?

1 view (last 30 days)
More specifically : I am receiving signal data continuously in Simulink which I first pass into a Matlab function block .Here I want the signal matrix to get continuously stored in my matlab workspace. Basically after this I also want to continuously keep retrieving values from the workspace while the model runs. I've tried using set_param() but that is giving error invalid object handle. Code I used in the Matlab function block of the model
function [y,z]= fcn(u)
coder.extrinsic('get_param');
coder.extrinsic('set_param');
y = u;
z = u;
set_param('setTest/fcn','lo',u);
end
Model Name : setTest
M-function name : fcn
Variable in M-function block to store : y
name with which to store variable in workspace : lo
value to store = u
where u = input Signal
I tried load_system('setTest') as well but to no avail What mistake am i making? If the approach is wrong what alternative do i have?
  1 Comment
Ryan Livingston
Ryan Livingston on 2 Apr 2014
If you could describe why the data needs to go to and from the MATLAB workspace, it would probably help us make suggestions. Knowing why it cannot be a signal would be helpful as well.
There are To/From Workspace Simulink blocks. However, I don't believe these are streaming as you requested:

Sign in to comment.

Answers (0)

Categories

Find more on Simulink Functions 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!