How do I use variable dimensions [var var] in Simulink memory blocks?

2 Ansichten (letzte 30 Tage)
Ryan Schwingle
Ryan Schwingle am 1 Jun. 2019
I am working on trans-coding an application that ordinarily would happen as a post process analysis using Matlab with the image processing toolbox to a real time dynamic model in simulink.
In the matlab environment, recursive defintions for vectors and matricies isn't an issue. Generally, one can grow an array based off of the last pass through your loop and append to the end of the matrix or vecor as follows:
for i=1:1:8
x = [x;y];
end
In simulink, you have no memory of what happened in the past iteration. So, I have used memory blocks on vectors and matricies with a known length. Just feed the output through the memory block and you can keep the previous value.
The memory function block will not work with variable sized I/O:
The unit delay functionblock will:
But it gives the following error:
"Block '/Simulink Function/Unit Delay' contains states that require resetting whenever the input signal sizes vary. This block property is inconsistent with a block property of '/Simulink Function/MATLAB Function2'; the output signal sizes of block 'F/Simulink Function/MATLAB Function2' depend on its input signal values. Consider placing /Simulink Function/Unit Delay' in an Enabled/Function-Call/Action/Resettable Subsystem and setting the parameter 'Propagate sizes of variable-size signals' on the corresponding control port block to: 'Only when enabling' for an Enabled or a Function-Call Subsystem; 'Only when execution is resumed' for an Action Subsystem; or 'Only when resetting' for a Resettable Subsystem."
I don't really want to reset the model each iteration, I just need to pass the past state to the present, append the value, and re-iterate.
The following individual seems to have the same requirements:
The attached unit delay is only for a vector, not for an expanding matrix. Is there a convenient unit delay that will work for 2D data?

Antworten (0)

Kategorien

Mehr zu Simulink Functions finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by