Replacing specific block with subsystems

I want to replace all the 'Memoey ' blocks in a model with a subsystem which would have the functionality of 'Memory' block. But the initial condition to the 'Memory' block should be passed from From workspace block as the initial conditions are changed frequently. I have the initial conditions stored in an array. Any help is appreciated. I am using MATLAB 2020a

 Accepted Answer

Here is one way. I think you would just use a constant block rather than From Workspace because From Workspace is looking to use a time sampled array or table, something like that.

5 Comments

Hello,
I need to use a 'From Workspace' block because I would have some data(some initial conditions) during actual runtime tests. I want those data to be initialized in all the memory blocks of the model so that I could fix some bugs.
Also could you please the usage of 'Digital Clock'
Thank you
See the MATLAB documentation on the block here for the types of data that the block can accept:
If you have data saved in the workspace that contains a scalar constant value that you want to use in this example subsystem or in Memory block, then copy that value into a new workspace variable and use that workspace variable in the Memory block, or in the constant block that I used here. The "Initial Condition" value must be a scalar value not a time series object.
Actually, some of the data are "Bus objects" and some are scalar constants which I want to get from the workspace. Its a mix of these signals.
Also please could you explain how the usage of a digital clock is making subsystem behave like a memory block?
After the first update, a memory block would make the output equal to input. This is what "initial condition" means. Or you may find that the Delay block is a better behavior, since it should be that output is delayed one step from the current input. You may experiment.
I do not know whether the From Workspace block can do what you want. Here is a link with more information.
Hi.
Could you please also suggest such a subsystem which would have the functionality of a 'Unit Delay' block?
Thanks

Sign in to comment.

More Answers (0)

Products

Release

R2020a

Tags

Community Treasure Hunt

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

Start Hunting!